Class Attribute

Direct Known Subclasses:
PolicyAttribute, ProductAttribute

public abstract class Attribute extends TypePart
A Attribute represents an attribute from a PolicyCmptType or a ProductCmptType.
  • Constructor Details

  • Method Details

    • isChangingOverTime

      public boolean isChangingOverTime()
      Returns true if this attribute is changing over time. For product attribute that means the attribute resides in the generation. For policy attributes the optional product configuration resides in the generation.
      Specified by:
      isChangingOverTime in class TypePart
      Returns:
      true if the attribute is changing over time, false if not
    • isProductRelevant

      public abstract boolean isProductRelevant()
      Returns true if this attribute is configured by the product. Product attributes are always product relevant.
      Returns:
      true if this attribute is configured by the product, false if not
    • getDatatype

      public Class<?> getDatatype()
      Returns the data type of this attribute.
      Returns:
      the attribute's datatype Class
    • getAttributeKind

      public AttributeKind getAttributeKind()
      Returns the possible kinds of this attribute.
      Returns:
      the kind of attribute
    • getValueSetKind

      public ValueSetKind getValueSetKind()
      Returns the ValueSetKind of this attribute.
      Returns:
      the kind of value set restricting this attribute
    • isOverriding

      public boolean isOverriding()
      Returns true if this attribute overrides another attribute. That means a supertype declares an attribute with the same name.
      Returns:
      true if this attribute overrides another, false if not
      See Also:
    • getSuperAttribute

      public Attribute getSuperAttribute()
      Returns the attribute that is overridden by this attribute if this attribute overrides another one. Otherwise returns null.
      Returns:
      The attribute that is overridden by this attribute.
      See Also:
    • findSuperAttribute

      public Optional<Attribute> findSuperAttribute()
      Returns the attribute that is overridden by this attribute if this attribute overrides another one. Otherwise returns null.
      Returns:
      The attribute that is overridden by this attribute.
      See Also:
    • toString

      public String toString()
      Overrides:
      toString in class ModelElement
    • createOverwritingAttributeFor

      public abstract Attribute createOverwritingAttributeFor(Type subType)
      Creates an attribute model for a sub type in which this attribute is overwritten. This is necessary to retrieve information contained in the class annotation such as labels if no getter is generated for the overwritten attribute in the sub class.
      Parameters:
      subType - a model type representing a sub type of this attribute's model type
      Returns:
      a Attribute for the given sub model type
    • getRelevantProductObject

      protected IProductObject getRelevantProductObject(IProductComponent productComponent, Calendar effectiveDate)
    • getRelevantProductObject

      protected IProductObject getRelevantProductObject(IProductComponentGeneration generation)
    • getDocumentation

      protected String getDocumentation(Locale locale, DocumentationKind type, String fallback)
      Overrides:
      getDocumentation in class ModelElement
    • validate

      public void validate(MessageList list, IValidationContext context, IProductComponent product, Calendar effectiveDate)
      Validates this attribute's configuration in the given product against the model.
      Overrides:
      validate in class TypePart
      Parameters:
      list - a MessageList, to which validation messages may be added
      context - the IValidationContext, needed to determine the Locale in which to create Messages
      product - the IProductComponent to validate
      effectiveDate - the date that determines which IProductComponentGeneration is to be validated, if the IProductComponent has any
    • getValueSetFromModel

      public org.faktorips.valueset.ValueSet<?> getValueSetFromModel()
      Returns the value set defined in the model for this attribute.
      Since:
      24.1
    • getDefaultValueFromModel

      public <T> T getDefaultValueFromModel()
      Returns the default value defined in the model for this attribute.
      Since:
      24.1
    • validate

      protected <V, R> void validate(MessageList list, IValidationContext context, Supplier<V> valueGetter, Supplier<R> referenceValueGetter, BiPredicate<V,R> valueChecker, String msgCode, String msgKey, String property, ObjectProperty invalidObjectProperty)
    • getResourceBundleName

      protected abstract String getResourceBundleName()