Interface IAllowedValuesConstraint

All Superinterfaces:
IAttributable, IConstraint, IDescribable

public interface IAllowedValuesConstraint extends IConstraint
Represents a rule requiring the value of a field or flag to match the name of one entry in a set of enumerated values.
  • Field Details

  • Method Details

    • getType

      default IConstraint.Type getType()
      Description copied from interface: IConstraint
      Get the constraint type.
      Specified by:
      getType in interface IConstraint
      Returns:
      the constraint type
    • getAllowedValues

      @NonNull Map<String,? extends IAllowedValue> getAllowedValues()
      Get the collection allowed values associated with this constraint.
      Returns:
      a mapping of value to the associated IAllowedValue item
    • getAllowedValue

      @Nullable default IAllowedValue getAllowedValue(String name)
      Get a specific allowed value by name, if it is defined for this constraint.
      Parameters:
      name - the value name
      Returns:
      the allowed value or null if the value is not defined
    • isAllowedOther

      boolean isAllowedOther()
      Determines if this allowed value constraint is open-ended (true) or closed. If "open-ended", the constraint allows the target's value to by any additional unspecified value. If "closed", the constraint requries the target's value to be one of the specified values.
      Returns:
      true if the constraint is "open-ended", or false otherwise
    • getExtensible

      @NonNull IAllowedValuesConstraint.Extensible getExtensible()
      Determines the degree to which this constraint can be extended by other constraints applied to the same value.
      Returns:
      the enumeration value
    • accept

      default <T, R> R accept(IConstraintVisitor<T,R> visitor, T state)
      Description copied from interface: IConstraint
      Used for double dispatch supporting the visitor pattern provided by implementations of IConstraintVisitor.
      Specified by:
      accept in interface IConstraint
      Type Parameters:
      T - the Java type of a state object passed to the visitor
      R - the Java type of the result returned by the visitor methods
      Parameters:
      visitor - the visitor implementation
      state - the state object passed to the visitor
      Returns:
      the visitation result
      See Also:
    • builder

      @NonNull static IAllowedValuesConstraint.Builder builder()
      Create a new constraint builder.
      Returns:
      the builder