Skip to contentPackage: JsonLdProperty$Access
JsonLdProperty$Access
Coverage
1: /**
2: * Copyright (C) 2022 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.jsonld.annotation;
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: * Allows to configure serialization and deserialization behavior for an attribute annotated by this annotation.
24: */
25: @Retention(RetentionPolicy.RUNTIME)
26: @Target(ElementType.FIELD)
27: public @interface JsonLdProperty {
28:
29: /**
30: * Allows to configure serialization and deserialization access to the property.
31: * <p>
32: * By default, the property is both serialized and deserialized. This can be restricted by making the property
33: * read-only or write-only.
34: *
35: * @return Type of access to annotated property
36: */
37: Access access() default Access.READ_WRITE;
38:
39: /**
40: * Specifies property access options.
41: */
42: enum Access {
43: /**
44: * The property can be written to (deserialization) and read from (serialization).
45: */
46: READ_WRITE,
47: /**
48: * The property can be only read from (serialization).
49: */
50: READ_ONLY,
51: /**
52: * The property can be only written to (deserialization).
53: */
54: WRITE_ONLY
55: }
56: }