Skip to contentMethod: ConfigParam(String, int, String)
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;
16:
17: /**
18: * Configuration parameters.
19: */
20: public enum ConfigParam {
21:
22: /**
23: * Whether to ignore unknown properties when deserializing JSON-LD.
24: * <p>
25: * If set to {@code false}, an exception will be thrown when unknown property is encountered.
26: */
27: IGNORE_UNKNOWN_PROPERTIES("ignoreUnknownProperties"),
28:
29: /**
30: * Package in which to look for mapped classes.
31: * <p>
32: * The scan is important for support for polymorphism in object deserialization.
33: */
34: SCAN_PACKAGE("scanPackage"),
35:
36: /**
37: * Whether to require an identifier when serializing an object.
38: * <p>
39: * If set to {@code true} and no identifier is found (either there is no identifier field or its value is {@code
40: * null}), an exception will be thrown. If configured to {@code false}, a blank node identifier is generated if no
41: * id is present.
42: */
43: REQUIRE_ID("requireId"),
44:
45: /**
46: * Allows assuming target type from the provided Java type when no types are specified in JSON-LD.
47: * <p>
48: * If set to {@code true}, JB4JSON-LD will attempt to use the provided Java type as the target type when
49: * deserializing a JSON-LD object which has no types declared.
50: * <p>
51: * Defaults to {@code false}, in which case an exception is thrown for a typeless JSON-LD object.
52: */
53: ASSUME_TARGET_TYPE("assumeTargetType"),
54:
55: /**
56: * Enables optimistic target type resolution.
57: * <p>
58: * This means that when a an ambiguous target type is encountered during deserialization of an object (i.e.,
59: * multiple concrete classes match the data type), instead of throwing an {@link
60: * cz.cvut.kbss.jsonld.exception.AmbiguousTargetTypeException}, one of the classes will be selected for
61: * instantiation.
62: * <p>
63: * Note that enabling this behavior should probably be done together with setting {@link #IGNORE_UNKNOWN_PROPERTIES}
64: * to true, so that any JSON-LD data for which the selected target class has no mapping are ignored and do not cause
65: * an exception to be thrown.
66: * <p>
67: * Defaults to {@code false}.
68: */
69: ENABLE_OPTIMISTIC_TARGET_TYPE_RESOLUTION("enableOptimisticTargetTypeResolution"),
70:
71: /**
72: * Configures optimistic type resolution to prefer concrete superclasses if possible.
73: * <p>
74: * If optimistic target type resolution is enabled, the target type resolver will select one of the matching classes
75: * for instantiation. If this parameter is set tot {@code true}, a parent class (if concrete) will be preferred for
76: * instantiation. If not, any of the classes may be selected.
77: * <p>
78: * Defaults to {@code false}.
79: *
80: * @see #ENABLE_OPTIMISTIC_TARGET_TYPE_RESOLUTION
81: */
82: PREFER_SUPERCLASS("preferSuperclass");
83:
84: private final String name;
85:
86: ConfigParam(String name) {
87: this.name = name;
88: }
89:
90: public String getName() {
91: return name;
92: }
93: }