Package org.faktorips.runtime.model.type
Class ProductAttribute
- java.lang.Object
-
- org.faktorips.runtime.model.type.ModelElement
-
- org.faktorips.runtime.model.type.TypePart
-
- org.faktorips.runtime.model.type.Attribute
-
- org.faktorips.runtime.model.type.ProductAttribute
-
public class ProductAttribute extends Attribute
Represents an attribute in a IpsProductCmptType.
-
-
Constructor Summary
Constructors Constructor Description ProductAttribute(Type type, boolean changingOverTime, java.lang.reflect.Method getter, java.lang.reflect.Method setter)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description AttributecreateOverwritingAttributeFor(Type subType)Creates an attribute model for a sub type in which this attribute is overwritten.ProductCmptTypegetModelType()Deprecated.UsegetType()ProductCmptTypegetType()Returns theProductCmptTypethis attribute belongs to.java.lang.ObjectgetValue(IProductComponent productComponent, java.util.Calendar effectiveDate)Returns the value of this attribute in the given product component (or its generation identified by the effectiveDate, if the attribute is changeable over time).java.lang.BooleanisMultiValue()Whether this attribute has just one value or multiple values.booleanisProductRelevant()Returns true if this attribute is configured by the product.-
Methods inherited from class org.faktorips.runtime.model.type.Attribute
findSuperAttribute, getAttributeKind, getDatatype, getRelevantProductObject, getSuperAttribute, getValueSetKind, isChangingOverTime, isOverriding, toString
-
Methods inherited from class org.faktorips.runtime.model.type.TypePart
getMessageHelper, getMessageKey, getTypeName
-
Methods inherited from class org.faktorips.runtime.model.type.ModelElement
createMessageHelper, getDescription, getDocumentation, getExtensionPropertyIds, getExtensionPropertyValue, getLabel, getName, getRelevantProductObject, invokeField, invokeMethod
-
-
-
-
Constructor Detail
-
ProductAttribute
public ProductAttribute(Type type, boolean changingOverTime, java.lang.reflect.Method getter, java.lang.reflect.Method setter)
-
-
Method Detail
-
getType
public ProductCmptType getType()
Returns theProductCmptTypethis attribute belongs to.
-
getModelType
@Deprecated public ProductCmptType getModelType()
Deprecated.UsegetType()Returns the parentType- Overrides:
getModelTypein classTypePart
-
isProductRelevant
public boolean isProductRelevant()
Description copied from class:AttributeReturns true if this attribute is configured by the product. Product attributes are always product relevant.- Specified by:
isProductRelevantin classAttribute- Returns:
trueif this attribute is configured by the product,falseif not
-
createOverwritingAttributeFor
public Attribute createOverwritingAttributeFor(Type subType)
Description copied from class:AttributeCreates 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.- Specified by:
createOverwritingAttributeForin classAttribute- Parameters:
subType- a model type representing a sub type of this attribute's model type- Returns:
- a
Attributefor the given sub model type
-
getValue
public java.lang.Object getValue(IProductComponent productComponent, java.util.Calendar effectiveDate)
Returns the value of this attribute in the given product component (or its generation identified by the effectiveDate, if the attribute is changeable over time).It is safe to cast the returned object to the class returned by
Attribute.getDatatype(), except when the attribute is a multi-value attribute - then aListis returned (and it's contents can be cast to the class returned byAttribute.getDatatype()).- Parameters:
productComponent- a product component based on the product component type this attribute belongs to.effectiveDate- (optional) the date to use for selecting the product component's generation, if this attributeAttribute.isChangingOverTime()
-
isMultiValue
public java.lang.Boolean isMultiValue()
Whether this attribute has just one value or multiple values. If the attribute has multiple values,Attribute.getDatatype()will still return the class of a single value, butgetValue(IProductComponent, Calendar)will return aList.
-
-