Enum Relevance

java.lang.Object
java.lang.Enum<Relevance>
org.faktorips.runtime.validation.Relevance
All Implemented Interfaces:
Serializable, Comparable<Relevance>, java.lang.constant.Constable

public enum Relevance extends Enum<Relevance>
Defines the relevance of a PolicyAttribute, derived from its value set:
  • An attribute with an empty (or null) value set is considered IRRELEVANT - no value should be set
  • An attribute with value set containing null is considered OPTIONAL - a value can be set but is not required
  • An attribute with a non-empty value set not containing null is considered MANDATORY - a value must be set
An attribute that is not IRRELEVANT (OPTIONAL or MANDATORY) is considered relevant - its value should for example be checked against the value set.
  • Enum Constant Details

    • IRRELEVANT

      public static final Relevance IRRELEVANT
      An attribute with an empty (or null) value set - no value should be set.
    • OPTIONAL

      public static final Relevance OPTIONAL
      An attribute with value set containing null - a value can be set but is not required.
    • MANDATORY

      public static final Relevance MANDATORY
      An attribute with a non-empty value set not containing null - a value must be set.
  • Method Details

    • values

      public static Relevance[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      Returns:
      an array containing the constants of this enum type, in the order they are declared
    • valueOf

      public static Relevance valueOf(String name)
      Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (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 type has no constant with the specified name
      NullPointerException - if the argument is null
    • isIrrelevant

      public static boolean isIrrelevant(IModelObject modelObject, String property)
      Returns whether the attribute with the given property name is considered IRRELEVANT for the given model object.
    • isIrrelevant

      public static boolean isIrrelevant(IModelObject modelObject, PolicyAttribute policyAttribute)
      Returns whether the given attribute is considered IRRELEVANT for the given model object.
    • isIrrelevant

      public static boolean isIrrelevant(org.faktorips.valueset.ValueSet<?> valueSet)
      Returns whether the given ValueSet is considered IRRELEVANT.
      Since:
      23.6
    • isMandatory

      public static boolean isMandatory(IModelObject modelObject, String property)
      Returns whether the attribute with the given property name is considered MANDATORY for the given model object.
    • isMandatory

      public static boolean isMandatory(IModelObject modelObject, PolicyAttribute policyAttribute)
      Returns whether the given attribute is considered MANDATORY for the given model object.
    • isMandatory

      public static boolean isMandatory(org.faktorips.valueset.ValueSet<?> valueSet)
      Returns whether the given ValueSet is considered MANDATORY.
      Since:
      23.6
    • isOptional

      public static boolean isOptional(IModelObject modelObject, String property)
      Returns whether the attribute with the given property name is considered OPTIONAL for the given model object.
    • isOptional

      public static boolean isOptional(IModelObject modelObject, PolicyAttribute policyAttribute)
      Returns whether the given attribute is considered OPTIONAL for the given model object.
    • isOptional

      public static boolean isOptional(org.faktorips.valueset.ValueSet<?> valueSet)
      Returns whether the given ValueSet is considered OPTIONAL.
      Since:
      23.6
    • isRelevant

      public static boolean isRelevant(IModelObject modelObject, String property)
      Returns whether the attribute with the given property name is considered relevant for the given model object.
    • isRelevant

      public static boolean isRelevant(IModelObject modelObject, PolicyAttribute policyAttribute)
      Returns whether the given attribute is considered relevant for the given model object.
    • isRelevant

      public static boolean isRelevant(org.faktorips.valueset.ValueSet<?> valueSet)
      Returns whether the given ValueSet is considered relevant.
      Since:
      23.6
    • of

      public static Relevance of(IModelObject modelObject, String property)
      Returns the Relevance of the PolicyAttribute identified by the given property name for the given model object.
    • of

      public static Relevance of(IModelObject modelObject, PolicyAttribute policyAttribute)
      Returns the Relevance of the given PolicyAttribute for the given model object.
    • of

      public static Relevance of(org.faktorips.valueset.ValueSet<?> valueSet)
      Returns the Relevance as interpretation of the given ValueSet.
      Since:
      23.6
    • asValueSetFor

      public <T> org.faktorips.valueset.ValueSet<T> asValueSetFor(IModelObject modelObject, PolicyAttribute policyAttribute)
      Returns a ValueSet for the given model object's attribute that matches this Relevance.
    • asValueSetFor

      public <T> org.faktorips.valueset.ValueSet<T> asValueSetFor(IModelObject modelObject, String property)
      Returns a ValueSet for the given model object's attribute identified by the given property name that matches this Relevance.
    • asValueSetFor

      public abstract <T> org.faktorips.valueset.ValueSet<T> asValueSetFor(IModelObject modelObject, PolicyAttribute policyAttribute, @CheckForNull org.faktorips.valueset.ValueSet<T> values)
      Returns a ValueSet for the given model object's attribute that matches this Relevance. If a parent value set is given, the returned value set will be of the same type (if allowed by the attribute's ValueSetKind) and contain no values not allowed by that parent value set (with the exception of a null value if the value set is converted to OPTIONAL).
      Parameters:
      modelObject - a model object
      policyAttribute - an attribute present on the model object's PolicyCmptType
      values - an optional ValueSet, which can limit the allowed values for the returned value set
    • asValueSetFor

      public <T> org.faktorips.valueset.ValueSet<T> asValueSetFor(IModelObject modelObject, PolicyAttribute policyAttribute, @CheckForNull Collection<T> values)
      Returns a ValueSet for the given model object's attribute that matches this Relevance. If a parent value set is given, the returned value set will be of the same type (if allowed by the attribute's ValueSetKind) and contain no values not allowed by that parent value set (with the exception of a null value if the value set is converted to OPTIONAL).
      Parameters:
      modelObject - a model object
      policyAttribute - an attribute present on the model object's PolicyCmptType
      values - the allowed values for the returned value set
    • asValueSetFor

      public <T> org.faktorips.valueset.ValueSet<T> asValueSetFor(IModelObject modelObject, String property, @CheckForNull org.faktorips.valueset.ValueSet<T> values)
      Returns a ValueSet for the given model object's attribute identified by the given property name that matches this Relevance. If a parent value set is given, the returned value set will be of the same type (if allowed by the attribute's ValueSetKind) and contain no values not allowed by that parent value set (with the exception of a null value if the value set is converted to OPTIONAL).
      Parameters:
      modelObject - a model object
      property - the name of an attribute present on the model object's PolicyCmptType
      values - an optional ValueSet, which can limit the allowed values for the returned value set
    • asValueSetFor

      public <T> org.faktorips.valueset.ValueSet<T> asValueSetFor(IModelObject modelObject, String property, @CheckForNull Collection<T> values)
      Returns a ValueSet for the given model object's attribute that matches this Relevance. If a parent value set is given, the returned value set will be of the same type (if allowed by the attribute's ValueSetKind) and contain no values not allowed by that parent value set (with the exception of a null value if the value set is converted to OPTIONAL).
      Parameters:
      modelObject - a model object
      property - the name of an attribute present on the model object's PolicyCmptType
      values - the allowed values for the returned value set