-
Notifications
You must be signed in to change notification settings - Fork 41
Annotation Details
Alessandro Vurro edited this page Oct 13, 2016
·
20 revisions
Below each annotation described in detail.
##JMap
public @interface JMap {
String value() default Constants.DEFAULT_FIELD_VALUE;
String[] attributes() default {};
Class<?>[] classes() default {};
}
-
value
represents the target field name. -
attributes
allows the definition of more than one target field name. -
classes
identifies the classes of theattributes
. The relationship between the attribute and the class is given by the position.
To know how this annotation works visit the wiki page: basic mapping.
##JGlobalMap
public @interface JGlobalMap {
String value() default Constants.DEFAULT_FIELD_VALUE;
Class<?>[] classes() default {};
String[] attributes() default {};
String[] excluded() default {};
}
-
value
represents the target field name. -
classes
identifies the classes to which the target field belongs. -
attributes
allows to define which fields of the current class must be part of the mapping. -
excluded
allows to define which fields of the current class must be excluded from mapping.
To know how this annotation works visit the wiki page: global mapping.
##JMapAccessor
public @interface JMapAccessor {
String name() default Constants.DEFAULT_FIELD_VALUE;
String get() default Constants.DEFAULT_ACCESSOR_VALUE;
String set() default Constants.DEFAULT_ACCESSOR_VALUE;
Class<?>[] classes() default {};
}
-
name
identifies the name of the field, if not defined refers to the field on which it is located. -
get
get method name, if not defined refers to the standard get method name. -
set
set method name, if not defined refers to the standard set method name.
To know how this annotation works visit the wiki page: custom accessors.
##JMapAccessors
public @interface JMapAccessors {
JMapAccessor[] value();
}
In case you should need to define more JMapAccessor, JMapAccessors comes in handy.
##JMapConversion
public @interface JMapConversion {
public static final String ALL = "all";
public static enum Type {DYNAMIC, STATIC};
String[] from() default {ALL};
String[] to() default {ALL};
Type type() default Type.STATIC;
boolean avoidSet() default false;
}
-
from
source fields. -
to
target fields. -
type
conversion type (DYNAMIC or STATIC). -
avoidSet
this boolean permits to avoid to use the set method for destination, this is useful with the beans generated by JAXB for example, where setting methods for collections aren't defined.
To know how this annotation works visit the wiki page: explicit conversions.
© 2016 Alessandro Vurro
- Home
- How to map
- Relations
- Conversions
- creation/enrichment
- XML
- Annotation
- API
- Configurations
- Utilities
- Examples
- Articles
- More information
- Performance tests
- Release Notes