Skip to contentPackage: Convert
Convert
Coverage
1: /**
2: * Copyright (C) 2023 Czech Technical University in Prague
3: *
4: * This program is free software: you can redistribute it and/or modify it under
5: * the terms of the GNU General Public License as published by the Free Software
6: * Foundation, either version 3 of the License, or (at your option) any
7: * later version.
8: *
9: * This program is distributed in the hope that it will be useful, but WITHOUT
10: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11: * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
12: * details. You should have received a copy of the GNU General Public License
13: * along with this program. If not, see <http://www.gnu.org/licenses/>.
14: */
15: package cz.cvut.kbss.jopa.model.annotations;
16:
17: import java.lang.annotation.ElementType;
18: import java.lang.annotation.Retention;
19: import java.lang.annotation.RetentionPolicy;
20: import java.lang.annotation.Target;
21:
22: /**
23: * Specifies the conversion of a Basic field or property.
24: * <p>
25: * The {@code Convert} annotation should not be used to specify conversion of the following: Id attributes, version
26: * attributes, relationship attributes, and attributes explicitly denoted as Enumerated or Temporal. Applications that
27: * specify such conversions will not be portable.
28: * <p>
29: * The {@code Convert} annotation may be applied to a basic attribute or to an element collection of basic type (in
30: * which case the converter is applied to the elements of the collection).
31: */
32: @Target({ElementType.FIELD,ElementType.METHOD})
33: @Retention(RetentionPolicy.RUNTIME)
34: public @interface Convert {
35:
36: /**
37: * Specifies the converter to be applied.
38: * <p>
39: * A value for this element must be specified if multiple converters would otherwise apply.
40: */
41: Class<?> converter() default void.class;
42:
43: /**
44: * Used to disable an auto-apply converter. If disableConversion is true, the converter element should not be
45: * specified.
46: */
47: boolean disableConversion() default false;
48: }