Package pro.projo.interfaces.annotation
Annotation Type Interface
@Target(PACKAGE) @Retention(RUNTIME) @Repeatable(Interfaces.class) public @interface Interface
The
Interface annotation captures the necessary information for generating an interface
from an existing class (or existing interface) while filtering for certain modifiers. This also
works for modifiers that are not compatible with interfaces, like e.g. static, which is
useful for extracting factory interfaces and similar patterns. For example, the original class
may have a number of static final methods for creating new objects; in the
generated interface these methods will just appear as regular non-static, non-final methods.- Author:
- Mirko Raner
-
Required Element Summary
-
Optional Element Summary
Optional Elements Modifier and Type Optional Element Description String[]extendTernaryisStaticMap[]mapModifier[]modifiersDeprecated.useisStatic()andvisibility()insteadOptionsoptionsVisibility[]visibility
-
Element Details
-
-
extend
String[] extend- Returns:
- the (optional, hence possibly empty) list of base interfaces to extend
- Default:
- {}
-
modifiers
Deprecated.useisStatic()andvisibility()insteadIndicates which modifiers a method in the original class must have so that it will be included in the generated interface. By default, this list is empty, i.e. all methods will be included, irrespective of their modifiers. If this list contains more than one element, the modifiers are combined using an and operation; for example, if the list isPUBLIC,FINAL,STATICthen only those methods will be included that are public and final and static. To realize an or operation, multiple@Interfaceannotations need to be used.- Returns:
- the method modifiers to be used for filtering
- Default:
- {}
-
map
Map[] map- Returns:
- optional type mappings, if any
- Default:
- {}
-
options
Options options- Returns:
- additional code generation options for this interface
- Default:
- @pro.projo.interfaces.annotation.Options
-
isStatic
Ternary isStatic- Returns:
- indication whether only static (
TRUE), only non-static (FALSE), or both static and non-static methods (EITHER) should be included.
- Default:
- EITHER
-
visibility
Visibility[] visibility- Returns:
- the visibilities to be included for method generation (for example,
PUBLICwill only include public methods,{PACKAGE,PROTECTED}will include protected and default/package visibility methods; there is no direct way to express "not private", but as every method has to have one of the four supported visibilities this can easily be expressed by listing all visibilities that should be included, i.e.{PUBLIC,PACKAGE,PROTECTED})
- Default:
- {PACKAGE, PUBLIC, PROTECTED, PRIVATE}
-