Enum Class LabelCardinality
- All Implemented Interfaces:
Serializable,Comparable<LabelCardinality>,Constable
Defines the label cardinality for graph elements. Each value declares its multiplicity constraints
via
min() and max(), and whether mutation is permitted via supportsMutation().
Providers declare their supported cardinality via Graph.Features.
Validation of label operations against these constraints is handled by
LabelCardinalityValidator.
- Since:
- 4.0.0
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionExactly one label, immutable.One or more labels.Zero or more labels, fully flexible. -
Method Summary
Modifier and TypeMethodDescriptionintmax()The maximum number of labels an element may have under this cardinality.intmin()The minimum number of labels an element must have under this cardinality.booleanWhether this cardinality allows multiple labels on an element simultaneously.booleanWhether this cardinality allows label mutation (addLabel/dropLabel).booleanWhether this cardinality allows an element to have zero labels.static LabelCardinalityReturns the enum constant of this class with the specified name.static LabelCardinality[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
ONE
Exactly one label, immutable. All mutation operations throw. This is the default for TinkerGraph and provides backward compatibility with TinkerPop 3.x. -
ONE_OR_MORE
One or more labels. The element must always have at least one label.dropLabels()always throws.dropLabel(x)succeeds only if at least one label remains. -
ZERO_OR_MORE
Zero or more labels, fully flexible. No constraints on the number of labels. Elements can have any number of labels including zero.
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-
min
public int min()The minimum number of labels an element must have under this cardinality. -
max
public int max()The maximum number of labels an element may have under this cardinality. -
supportsMultiLabel
public boolean supportsMultiLabel()Whether this cardinality allows multiple labels on an element simultaneously. -
supportsZeroLabels
public boolean supportsZeroLabels()Whether this cardinality allows an element to have zero labels. -
supportsMutation
public boolean supportsMutation()Whether this cardinality allows label mutation (addLabel/dropLabel).
-