public abstract class PolicyAttribute extends Attribute
PolicyCmptType.IModelTypeAttribute.AttributeType, IModelTypeAttribute.ValueSetType| Constructor and Description |
|---|
PolicyAttribute(Type type,
IpsAttribute attributeAnnotation,
IpsExtensionProperties extensionProperties,
Class<?> datatype,
boolean changingOverTime) |
| Modifier and Type | Method and Description |
|---|---|
abstract Object |
getDefaultValue(IConfigurableModelObject modelObject)
Returns the product configured default value of the attribute identified by this model type
attribute.
|
abstract Object |
getDefaultValue(IProductComponent source,
Calendar effectiveDate)
Returns the product configured default value of the attribute identified by this model type
attribute.
|
PolicyCmptType |
getModelType()
Deprecated.
Use
getType() |
PolicyAttribute |
getSuperAttribute()
Returns the attribute that is overridden by this attribute if this attribute overrides
another one.
|
PolicyCmptType |
getType()
Returns the
PolicyCmptType this attribute belongs to. |
abstract Object |
getValue(IModelObject modelObject)
Returns the value of the given model object's attribute identified by this model type
attribute.
|
org.faktorips.valueset.ValueSet<?> |
getValueSet(IModelObject modelObject)
Returns the value set of the given model object's attribute identified by this model type
attribute.
|
abstract org.faktorips.valueset.ValueSet<?> |
getValueSet(IModelObject modelObject,
IValidationContext context)
Returns the value set of the given model object's attribute identified by this model type
attribute.
|
org.faktorips.valueset.ValueSet<?> |
getValueSet(IProductComponent source,
Calendar effectiveDate)
Returns the value set of the given model object's attribute identified by this model type
attribute.
|
abstract org.faktorips.valueset.ValueSet<?> |
getValueSet(IProductComponent source,
Calendar effectiveDate,
IValidationContext context)
Returns the value set of the given model object's attribute identified by this model type
attribute.
|
abstract void |
setDefaultValue(IConfigurableModelObject modelObject,
Object defaultValue)
Sets the product configured default value of the attribute identified by this model type
attribute.
|
abstract void |
setDefaultValue(IProductComponent target,
Calendar effectiveDate,
Object defaultValue)
Sets the product configured default value of the attribute identified by this model type
attribute.
|
abstract void |
setValue(IModelObject modelObject,
Object value)
Sets the given model object's attribute identified by this model type attribute to the given
value.
|
abstract void |
setValueSet(IConfigurableModelObject modelObject,
org.faktorips.valueset.ValueSet<?> valueSet)
Sets the product configured set of allowed values of the attribute identified by this model
type attribute.
|
abstract void |
setValueSet(IProductComponent target,
Calendar effectiveDate,
org.faktorips.valueset.ValueSet<?> valueSet)
Sets the product configured set of allowed values of the attribute identified by this model
type attribute.
|
createOverwritingAttributeFor, getAttributeKind, getAttributeType, getDatatype, getRelevantProductObject, getValueSetKind, getValueSetType, isChangingOverTime, isOverriding, isProductRelevant, toStringgetMessageHelper, getMessageKey, getTypeNamecreateMessageHelper, getDescription, getDocumentation, getExtensionPropertyIds, getExtensionPropertyValue, getLabel, getName, getRelevantProductObject, invokeField, invokeMethodclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetDescription, getExtensionPropertyIds, getExtensionPropertyValue, getLabel, getNamepublic PolicyAttribute(Type type, IpsAttribute attributeAnnotation, IpsExtensionProperties extensionProperties, Class<?> datatype, boolean changingOverTime)
public PolicyCmptType getType()
PolicyCmptType this attribute belongs to.@Deprecated public PolicyCmptType getModelType()
getType()TypegetModelType in interface IModelTypeAttributegetModelType in class TypePartpublic PolicyAttribute getSuperAttribute()
Attributenull.getSuperAttribute in class AttributeAttribute.isOverriding()public abstract Object getValue(IModelObject modelObject)
modelObject - a model object corresponding to the Type this attribute belongs toIllegalArgumentException - if the model object does not have an attribute fitting this
model type attribute or that attribute is not accessible for any reasonpublic abstract void setValue(IModelObject modelObject, Object value)
modelObject - a model object corresponding to the Type this attribute belongs tovalue - an object of this model type attribute's datatypeIllegalArgumentException - if the model object does not have a changeable attribute
fitting this model type attribute or that attribute is not accessible for any
reason or the value does not fit the attribute's datatype.UnsupportedOperationException - if invoked on a
AttributeKind.CONSTANT attribute.public abstract Object getDefaultValue(IConfigurableModelObject modelObject)
IllegalStateException if the model object has no
getDefaultValue() method for this attribute. This also occurs if the corresponding policy
class is not configured by a product class.modelObject - the configurable model object from which product component and (if
necessary) effective date can be retrievedIllegalStateException - if the model object has no getter method for this attribute's
default value. This also occurs if the corresponding policy class is not
configured by a product class.IllegalArgumentException - if the invocation of the method that should get the default
value for this attribute fails for any reasongetDefaultValue(IProductComponent, Calendar)public abstract Object getDefaultValue(IProductComponent source, Calendar effectiveDate)
source - the product component to read the attribute default value from.effectiveDate - the date to determine the product component generation. If
null the latest generation is used. Is ignored if the attribute's
configuration is not changing over time.UnsupportedOperationException - if invoked on a
AttributeKind.CONSTANT attribute.IllegalStateException - if the model object has no getter method for this attribute's
default value. This also occurs if the corresponding policy class is not
configured by a product class.IllegalArgumentException - if the invocation of the method that should get the default
value for this attribute fails for any reasonpublic abstract void setDefaultValue(IConfigurableModelObject modelObject, Object defaultValue)
modelObject - the configurable model object from which product component and (if
necessary) effective date can be retrieveddefaultValue - the new default valueUnsupportedOperationException - if invoked on a
AttributeKind.CONSTANT attribute.IllegalStateException - if the model object has no setter method for this attribute's
default value. This also occurs if the corresponding policy class is not
configured by a product class.IllegalArgumentException - if the invocation of the method that should set the default
value for this attribute fails for any reasonpublic abstract void setDefaultValue(IProductComponent target, Calendar effectiveDate, Object defaultValue)
target - the product component to write the attribute default value toeffectiveDate - the date to determine the product component generation. If
null the latest generation is used. Is ignored if the attribute's
configuration is not changing over time.defaultValue - the new default valueUnsupportedOperationException - if invoked on a
AttributeKind.CONSTANT attribute.IllegalStateException - if the model object has no setter method for this attribute's
default value. This also occurs if the corresponding policy class is not
configured by a product class.IllegalArgumentException - if the invocation of the method that should set the default
value for this attribute fails for any reasonpublic abstract org.faktorips.valueset.ValueSet<?> getValueSet(IModelObject modelObject, IValidationContext context)
Note: If the PolicyCmptType this PolicyAttribute belongs to defines
an UnrestrictedValueSet including null, no method is generated by
Faktor-IPS. Therefore, a value set method in a subclass is not found even if the
IModelObject passed to this method is an instance of that subclass. To make sure to
get the correct value set, always use IpsModel.getPolicyCmptType(IModelObject) on the
actual IModelObject instead of IpsModel.getPolicyCmptType(Class) on the super
class.
modelObject - a model objectIllegalStateException - if the method that should return a value set for this attribute
has too many argumentsIllegalArgumentException - if the invocation of the method that should return a value
set for this attribute fails for any reasonpublic org.faktorips.valueset.ValueSet<?> getValueSet(IModelObject modelObject)
Note: If the PolicyCmptType this PolicyAttribute belongs to defines
an UnrestrictedValueSet including null, no method is generated by
Faktor-IPS. Therefore, a value set method in a subclass is not found even if the
IModelObject passed to this method is an instance of that subclass. To make sure to
get the correct value set, always use IpsModel.getPolicyCmptType(IModelObject) on the
actual IModelObject instead of IpsModel.getPolicyCmptType(Class) on the super
class.
IValidationContext.modelObject - a model objectUnsupportedOperationException - if invoked on a
AttributeKind.CONSTANT attribute.IllegalStateException - if the method that should return a value set for this attribute
has too many argumentsIllegalArgumentException - if the invocation of the method that should return a value
set for this attribute fails for any reasonpublic abstract org.faktorips.valueset.ValueSet<?> getValueSet(IProductComponent source, Calendar effectiveDate, IValidationContext context)
UnrestrictedValueSet if there is no method that returns a value
set for this attribute.source - the product component to read an attribute value set from. Must correspond to
the Type this attribute belongs to.effectiveDate - the date to determine the product component generation. If
null the latest generation is used. Is ignored if the attribute's
configuration is not changing over time.UnsupportedOperationException - if invoked on a
AttributeKind.CONSTANT attribute.IllegalStateException - if the method that should return a value set for this attribute
has too many argumentsIllegalArgumentException - if the invocation of the method that should return a value
set for this attribute fails for any reasonpublic org.faktorips.valueset.ValueSet<?> getValueSet(IProductComponent source, Calendar effectiveDate)
UnrestrictedValueSet if there is no method that returns a value
set for this attribute.
This method uses a default IValidationContext.
source - the product component to read an attribute value set from. Must correspond to
the Type this attribute belongs to.effectiveDate - the date to determine the product component generation. If
null the latest generation is used. Is ignored if the attribute's
configuration is not changing over time.UnsupportedOperationException - if invoked on a
AttributeKind.CONSTANT attribute.IllegalStateException - if the method that should return a value set for this attribute
has too many argumentsIllegalArgumentException - if the invocation of the method that should return a value
set for this attribute fails for any reasonpublic abstract void setValueSet(IConfigurableModelObject modelObject, org.faktorips.valueset.ValueSet<?> valueSet)
Caution: as generics are erased at runtime, it is possible to set a ValueSet
of a mismatched type with this method, for example an OrderedValueSet<String> for an attribute with Attribute.getDatatype() Integer,
which will result in a ClassCastException on later method calls.
modelObject - the configurable model object from which product component and (if
necessary) effective date can be retrievedvalueSet - the new value setUnsupportedOperationException - if invoked on a
AttributeKind.CONSTANT attribute.ClassCastException - if the type of value set does not match the property's
configurationIllegalStateException - if the model object has no setter method for this attribute's
value set. This also occurs if the corresponding policy class is not configured
by a product class.IllegalArgumentException - if the invocation of the method that should set the value
set for this attribute fails for any reasonpublic abstract void setValueSet(IProductComponent target, Calendar effectiveDate, org.faktorips.valueset.ValueSet<?> valueSet)
Caution: as generics are erased at runtime, it is possible to set a ValueSet
of a mismatched type with this method, for example an OrderedValueSet<String> for an attribute with Attribute.getDatatype() Integer,
which will result in a ClassCastException on later method calls.
target - the product component to write the attribute value set to. Must correspond to
the Type this attribute belongs to.effectiveDate - the date to determine the product component generation. If
null the latest generation is used. Is ignored if the attribute's
configuration is not changing over time.valueSet - the new value setUnsupportedOperationException - if invoked on a
AttributeKind.CONSTANT attribute.ClassCastException - if the type of value set does not match the property's
configurationIllegalStateException - if the model object has no setter method for this attribute's
value set. This also occurs if the corresponding policy class is not configured
by a product class.IllegalArgumentException - if the invocation of the method that should set the value
set for this attribute fails for any reasonCopyright © 2021. All rights reserved.