public class ConstantPolicyAttribute extends PolicyAttribute
CONSTANT
attribute.IModelTypeAttribute.AttributeType, IModelTypeAttribute.ValueSetType| Constructor and Description |
|---|
ConstantPolicyAttribute(Type type,
Field field,
boolean changingOverTime) |
| Modifier and Type | Method and Description |
|---|---|
ConstantPolicyAttribute |
createOverwritingAttributeFor(Type subType)
Creates an attribute model for a sub type in which this attribute is overwritten.
|
Object |
getDefaultValue(IConfigurableModelObject modelObject)
Returns the product configured default value of the attribute identified by this model type
attribute.
|
Object |
getDefaultValue(IProductComponent source,
Calendar effectiveDate)
Returns the product configured default value of the attribute identified by this model type
attribute.
|
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,
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,
IValidationContext context)
Returns the value set of the given model object's attribute identified by this model type
attribute.
|
boolean |
isProductRelevant()
Returns true if this attribute is configured by the product.
|
void |
setDefaultValue(IConfigurableModelObject modelObject,
Object defaultValue)
Sets the product configured default value of the attribute identified by this model type
attribute.
|
void |
setDefaultValue(IProductComponent source,
Calendar effectiveDate,
Object defaultValue)
Sets the product configured default value of the attribute identified by this model type
attribute.
|
void |
setValue(IModelObject modelObject,
Object value)
Sets the given model object's attribute identified by this model type attribute to the given
value.
|
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.
|
void |
setValueSet(IProductComponent source,
Calendar effectiveDate,
org.faktorips.valueset.ValueSet<?> valueSet)
Sets the product configured set of allowed values of the attribute identified by this model
type attribute.
|
getModelType, getSuperAttribute, getType, getValueSet, getValueSetgetAttributeKind, getAttributeType, getDatatype, getRelevantProductObject, getValueSetKind, getValueSetType, isChangingOverTime, isOverriding, 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 boolean isProductRelevant()
AttributeisProductRelevant in interface IModelTypeAttributeisProductRelevant in class Attributetrue if this attribute is configured by the product, false
if notpublic Object getValue(IModelObject modelObject)
PolicyAttributegetValue in class PolicyAttributemodelObject - a model object corresponding to the Type this attribute belongs topublic void setValue(IModelObject modelObject, Object value)
PolicyAttributesetValue in class PolicyAttributemodelObject - a model object corresponding to the Type this attribute belongs tovalue - an object of this model type attribute's datatypepublic ConstantPolicyAttribute createOverwritingAttributeFor(Type subType)
AttributecreateOverwritingAttributeFor in class AttributesubType - a model type representing a sub type of this attribute's model typeAttribute for the given sub model typepublic Object getDefaultValue(IConfigurableModelObject modelObject)
PolicyAttributeIllegalStateException 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.getDefaultValue in class PolicyAttributemodelObject - the configurable model object from which product component and (if
necessary) effective date can be retrievedPolicyAttribute.getDefaultValue(IProductComponent, Calendar)public Object getDefaultValue(IProductComponent source, Calendar effectiveDate)
PolicyAttributegetDefaultValue in class PolicyAttributesource - 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.public void setDefaultValue(IConfigurableModelObject modelObject, Object defaultValue)
PolicyAttributesetDefaultValue in class PolicyAttributemodelObject - the configurable model object from which product component and (if
necessary) effective date can be retrieveddefaultValue - the new default valuepublic void setDefaultValue(IProductComponent source, Calendar effectiveDate, Object defaultValue)
PolicyAttributesetDefaultValue in class PolicyAttributesource - 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 valuepublic org.faktorips.valueset.ValueSet<?> getValueSet(IModelObject modelObject, IValidationContext context)
PolicyAttribute
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.
getValueSet in class PolicyAttributemodelObject - a model objectpublic org.faktorips.valueset.ValueSet<?> getValueSet(IProductComponent source, Calendar effectiveDate, IValidationContext context)
PolicyAttributeUnrestrictedValueSet if there is no method that returns a value
set for this attribute.getValueSet in class PolicyAttributesource - 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.public void setValueSet(IProductComponent source, Calendar effectiveDate, org.faktorips.valueset.ValueSet<?> valueSet)
PolicyAttribute
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.
setValueSet in class PolicyAttributesource - 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 setpublic void setValueSet(IConfigurableModelObject modelObject, org.faktorips.valueset.ValueSet<?> valueSet)
PolicyAttribute
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.
setValueSet in class PolicyAttributemodelObject - the configurable model object from which product component and (if
necessary) effective date can be retrievedvalueSet - the new value setCopyright © 2021. All rights reserved.