Skip to content

Package: Attribute$PersistentAttributeType

Attribute$PersistentAttributeType

nameinstructionbranchcomplexitylinemethod
static {...}
M: 0 C: 34
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 4
100%
M: 0 C: 1
100%

Coverage

1: /**
2: * Copyright (C) 2019 Czech Technical University in Prague
3: * <p>
4: * This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public
5: * License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later
6: * version.
7: * <p>
8: * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
9: * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
10: * details. You should have received a copy of the GNU General Public License along with this program. If not, see
11: * <http://www.gnu.org/licenses/>.
12: */
13: package cz.cvut.kbss.jopa.model.metamodel;
14:
15: import cz.cvut.kbss.jopa.NonJPA;
16: import cz.cvut.kbss.jopa.UnusedJPA;
17: import cz.cvut.kbss.jopa.model.IRI;
18: import cz.cvut.kbss.jopa.model.annotations.CascadeType;
19: import cz.cvut.kbss.jopa.model.annotations.ParticipationConstraint;
20:
21: /**
22: * Represents an attribute of a Java type.
23: *
24: * @param <X> The represented type that contains the attribute
25: * @param <Y> The type of the represented attribute
26: */
27: public interface Attribute<X, Y> extends FieldSpecification<X, Y> {
28:
29: enum PersistentAttributeType {
30: /**
31: * Corresponds to datatype properties
32: */
33: @NonJPA
34: DATA,
35:
36: /**
37: * Corresponds to object properties
38: */
39: @NonJPA
40: OBJECT,
41:
42: /**
43: * Corresponds to annotation properties
44: */
45: @NonJPA
46: ANNOTATION;
47: }
48:
49: /**
50: * Return the persistent attribute type for the attribute.
51: *
52: * @return persistent attribute type
53: */
54: PersistentAttributeType getPersistentAttributeType();
55:
56: /**
57: * Return the java.lang.reflect.Member for the represented attribute.
58: *
59: * @return corresponding java.lang.reflect.Member
60: */
61: @UnusedJPA
62: java.lang.reflect.Member getJavaMember();
63:
64: /**
65: * Return the java.lang.reflect.Member for the represented attribute.
66: *
67: * @return corresponding java.lang.reflect.Member
68: */
69: @NonJPA
70: IRI getIRI();
71:
72: /**
73: * Return the set of cascade types specified for this attribute.
74: *
75: * @return corresponding array of cascade types. This method returns an empty array if no cascade type is specified.
76: * @throws IllegalArgumentException if getPersistentAttributeType() returns DATA or ANNOTATION.
77: */
78: @NonJPA
79: CascadeType[] getCascadeTypes();
80:
81: /**
82: * Is the attribute an association.
83: *
84: * @return boolean indicating whether the attribute corresponds to an association
85: */
86: boolean isAssociation();
87:
88: /**
89: * Whether the attribute can be without value.
90: * <p>
91: * Note that if {@link #getConstraints()} contains {@link ParticipationConstraint}s, this property should be
92: * ignored.
93: *
94: * @return boolean indicating whether the attribute can be empty
95: */
96: boolean isNonEmpty();
97:
98: /**
99: * Does the attribute contain values in lexical form.
100: * <p>
101: * Note that lexical form attributes are effectively read only.
102: * <p>
103: * Applies only to datatype and annotation properties, object properties cannot be in lexical form.
104: *
105: * @return Boolean indicating whether the attribute contains values in lexical form
106: */
107: boolean isLexicalForm();
108:
109: /**
110: * Does the attribute represent simple literals.
111: * <p>
112: * Simple literals are stored as {@code xsd:string}, i.e., strings without language tag.
113: * <p>
114: * Applies only to datatype and annotation properties, object properties cannot be simple literals.
115: *
116: * @return Boolean indicating whether the attribute represents simple literals.
117: */
118: boolean isSimpleLiteral();
119:
120: /**
121: * Returns participation constraints specified for this attribute.
122: *
123: * @return Array of participation constraints
124: */
125: ParticipationConstraint[] getConstraints();
126: }