Package pro.projo.interfaces.annotation
Annotation Type Map
@Target(PACKAGE) @Retention(RUNTIME) public @interface Map
The
For example, given:
@Map annotation defines a non-default type mapping within an
@Interface annotation. By default, in an interface extracted from
an existing type, the type occurrence of the existing type will be replaced with the
generated interface.
For example, given:
package existing;
public class Type
{
public static Type self(Type type)
{
return type;
}
}
and
@Interface(from=existing.Type.class, generate="NewType") package generated;the generated interface would look like this:
public interface NewType
{
NewType self(NewType type);
}
In other words, the original interface type is replaced by the generated type in all places
where it occurs. Most of the time, this is exactly the desired behavior, but there are some
scenarios where a different type needs to be used instead. This occurs, for example, when an
existing type declares static and non-static methods that need to be extracted into separate
interfaces but need to refer to some common types. The @Map annotation can be
used to define these mappings.- Author:
- Mirko Raner
-
Element Details
-
type
Class<?> type- Returns:
- the original type within the context of the enclosing
@Interfaceannotation that is to be mapped.
-
to
String to- Returns:
- the generated destination type by which the original type is to be replaced.
-