Package io.vertigo.core.lang
Enum Class Cardinality
- All Implemented Interfaces:
Serializable,Comparable<Cardinality>,Constable
Defines relationship multiplicities in data models.
Supports three cardinality types:
- Optional (0..1) - Symbol: ?
- Mandatory (1) - Symbol: 1
- Multiple (0..*) - Symbol: *
Used for defining and validating entity associations.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionMultiple relationship allowing zero or more instances.Mandatory relationship requiring exactly one instance.Optional relationship allowing zero or one instance. -
Method Summary
Modifier and TypeMethodDescriptionstatic CardinalityfromSymbol(String sCardinality) Parses cardinality from standard notation symbol.booleanhasMany()Checks if relationship allows multiple instances.booleanhasOne()Checks if relationship requires exactly one instance.booleanChecks if relationship is optional.toSymbol()Converts cardinality to standard notation symbol.static CardinalityReturns the enum constant of this class with the specified name.static Cardinality[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
OPTIONAL_OR_NULLABLE
Optional relationship allowing zero or one instance. Used for nullable references. Symbol: ? -
ONE
Mandatory relationship requiring exactly one instance. Used for required references. Symbol: 1 -
MANY
Multiple relationship allowing zero or more instances. Used for collections and lists. Symbol: *
-
-
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
-
isOptionalOrNullable
public boolean isOptionalOrNullable()Checks if relationship is optional.- Returns:
- true for OPTIONAL_OR_NULLABLE cardinality
-
hasOne
public boolean hasOne()Checks if relationship requires exactly one instance.- Returns:
- true for ONE cardinality
-
hasMany
public boolean hasMany()Checks if relationship allows multiple instances.- Returns:
- true for MANY cardinality
-
fromSymbol
Parses cardinality from standard notation symbol. Supported symbols: ?, 1, *- Parameters:
sCardinality- Symbol to parse- Returns:
- Corresponding cardinality value
- Throws:
VSystemException- if symbol is invalid
-
toSymbol
Converts cardinality to standard notation symbol.- Returns:
- Symbol (?, 1, or *)
-