@Target(value=PACKAGE) @Retention(value=RUNTIME) public @interface Map
@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.
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.public abstract Class<?> type
@Interface
annotation that is to be mapped.public abstract String to
Copyright © 2022. All rights reserved.