Enum Class Cardinality

java.lang.Object
java.lang.Enum<Cardinality>
io.vertigo.core.lang.Cardinality
All Implemented Interfaces:
Serializable, Comparable<Cardinality>, Constable

public enum Cardinality extends Enum<Cardinality>
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.
  • Enum Constant Details

    • OPTIONAL_OR_NULLABLE

      public static final Cardinality OPTIONAL_OR_NULLABLE
      Optional relationship allowing zero or one instance. Used for nullable references. Symbol: ?
    • ONE

      public static final Cardinality ONE
      Mandatory relationship requiring exactly one instance. Used for required references. Symbol: 1
    • MANY

      public static final Cardinality MANY
      Multiple relationship allowing zero or more instances. Used for collections and lists. Symbol: *
  • Method Details

    • values

      public static Cardinality[] 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

      public static Cardinality valueOf(String name)
      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 name
      NullPointerException - 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

      public static Cardinality fromSymbol(String sCardinality)
      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

      public String toSymbol()
      Converts cardinality to standard notation symbol.
      Returns:
      Symbol (?, 1, or *)