Skip to contentPackage: Converter
Converter
Coverage
1: package cz.cvut.kbss.jopa.model.annotations;
2:
3: import java.lang.annotation.ElementType;
4: import java.lang.annotation.Retention;
5: import java.lang.annotation.RetentionPolicy;
6: import java.lang.annotation.Target;
7:
8: /**
9: * Specifies that the annotated class is a converter and defines its scope.
10: * <p>
11: * A converter class must be annotated with the Converter annotation. If the autoApply element is specified as true, the
12: * persistence provider must automatically apply the converter to all mapped attributes of the specified target type for
13: * all entities in the persistence unit.
14: * <p>
15: * Note that Id attributes, version attributes, relationship attributes, and attributes explicitly annotated as
16: * Enumerated or Temporal will not be converted.
17: * <p>
18: * Note that if autoApply is true, the Convert annotation may be used to override or disable auto-apply conversion on a
19: * per-attribute basis.
20: * <p>
21: * If autoApply is false, only those attributes of the target type for which the Convert annotation has been specified
22: * will be converted.
23: * <p>
24: * If there is more than one converter defined for the same target type, the Convert annotation should be used to
25: * explicitly specify which converter to use.
26: */
27: @Target(ElementType.TYPE)
28: @Retention(RetentionPolicy.RUNTIME)
29: public @interface Converter {
30:
31: /**
32: * Whether to apply the converter automatically.
33: */
34: boolean autoApply() default false;
35: }