Package manifold.ext.delegation.rt.api
Annotation Type link
-
@Target(FIELD) @Retention(RUNTIME) public @interface link
Use@linkto automatically transfer calls on unimplemented interface methods to fields in the same class.- Choose between call forwarding and true delegation with
@part - Override linked interface methods, optionally using
partclasses (solves the Self problem) - Share super interface implementations (solves the Diamond problem)
- Configure class implementation dynamically
class MyClass implements MyInterface { @link MyInterface myInterface; // transfers calls on MyInterface to myInterface public MyClass(MyInterface myInterface) { this.myInterface = myInterface; // dynamically configure behavior } } - Choose between call forwarding and true delegation with
-
-
Optional Element Summary
Optional Elements Modifier and Type Optional Element Description Class<?>[]shareWhere interface overlap exists with other links, this list of interfaces resolves which links to use.booleanshareAllIf true, indicates this link is shared where interface overlap exists with other links.Class<?>[]valueSpecify interfaces to link.
-
-
-
Element Detail
-
value
Class<?>[] value
Specify interfaces to link. This value overrides the declared type of the field. If no interfaces are specified (default), the linked interfaces are derived from the field's declared type.- Default:
- {}
-
-
-
share
Class<?>[] share
Where interface overlap exists with other links, this list of interfaces resolves which links to use. Otherwise, overlapping interfaces are not linked and the class must implement them directly, or it must be declared abstract. If two or more links declare to share the same interface, a compiler error results.- Default:
- {}
-
-
-
shareAll
boolean shareAll
If true, indicates this link is shared where interface overlap exists with other links. Similar toshare(), but includes all interfaces from this link that overlap.- Default:
- false
-
-