Package org.faktorips.runtime.model.type
Class Attribute
- java.lang.Object
-
- org.faktorips.runtime.model.type.ModelElement
-
- org.faktorips.runtime.model.type.TypePart
-
- org.faktorips.runtime.model.type.Attribute
-
- Direct Known Subclasses:
PolicyAttribute,ProductAttribute
public abstract class Attribute extends TypePart
AAttributerepresents an attribute from a PolicyCmptType or a ProductCmptType.
-
-
Constructor Summary
Constructors Constructor Description Attribute(Type type, IpsAttribute attributeAnnotation, IpsExtensionProperties extensionProperties, java.lang.Class<?> datatype, boolean changingOverTime)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract AttributecreateOverwritingAttributeFor(Type subType)Creates an attribute model for a sub type in which this attribute is overwritten.java.util.Optional<Attribute>findSuperAttribute()Returns the attribute that is overridden by this attribute if this attribute overrides another one.AttributeKindgetAttributeKind()Returns the possible kinds of this attribute.java.lang.Class<?>getDatatype()Returns the data type of this attribute.protected java.lang.ObjectgetRelevantProductObject(IProductComponent productComponent, java.util.Calendar effectiveDate)AttributegetSuperAttribute()Returns the attribute that is overridden by this attribute if this attribute overrides another one.ValueSetKindgetValueSetKind()Returns theValueSetKindof this attribute.booleanisChangingOverTime()Returns true if this attribute is changing over time.booleanisOverriding()Returnstrueif this attribute overrides another attribute.abstract booleanisProductRelevant()Returns true if this attribute is configured by the product.java.lang.StringtoString()-
Methods inherited from class org.faktorips.runtime.model.type.TypePart
getMessageHelper, getMessageKey, getModelType, getType, getTypeName
-
Methods inherited from class org.faktorips.runtime.model.type.ModelElement
createMessageHelper, getDescription, getDocumentation, getExtensionPropertyIds, getExtensionPropertyValue, getLabel, getName, getRelevantProductObject, invokeField, invokeMethod
-
-
-
-
Constructor Detail
-
Attribute
public Attribute(Type type, IpsAttribute attributeAnnotation, IpsExtensionProperties extensionProperties, java.lang.Class<?> datatype, boolean changingOverTime)
-
-
Method Detail
-
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.- Returns:
trueif the attribute is changing over time,falseif not
-
isProductRelevant
public abstract boolean isProductRelevant()
Returns true if this attribute is configured by the product. Product attributes are always product relevant.- Returns:
trueif this attribute is configured by the product,falseif not
-
getDatatype
public java.lang.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 theValueSetKindof this attribute.- Returns:
- the kind of value set restricting this attribute
-
isOverriding
public boolean isOverriding()
Returnstrueif this attribute overrides another attribute. That means a supertype declares an attribute with the same name.- Returns:
trueif this attribute overrides another,falseif not- See Also:
getSuperAttribute()
-
getSuperAttribute
public Attribute getSuperAttribute()
Returns the attribute that is overridden by this attribute if this attribute overrides another one. Otherwise returnsnull.- Returns:
- The attribute that is overridden by this attribute.
- See Also:
isOverriding()
-
findSuperAttribute
public java.util.Optional<Attribute> findSuperAttribute()
Returns the attribute that is overridden by this attribute if this attribute overrides another one. Otherwise returnsnull.- Returns:
- The attribute that is overridden by this attribute.
- See Also:
isOverriding()
-
toString
public java.lang.String toString()
- Overrides:
toStringin classModelElement
-
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
Attributefor the given sub model type
-
getRelevantProductObject
protected java.lang.Object getRelevantProductObject(IProductComponent productComponent, java.util.Calendar effectiveDate)
-
-