Class ConstantPolicyAttribute
CONSTANT
attribute.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreateOverwritingAttributeFor(Type subType) Creates an attribute model for a sub type in which this attribute is overwritten.getDefaultValue(IModelObject modelObject) Returns the (product configured) default value of the attribute identified by this model type attribute.getDefaultValue(IProductComponent source, Calendar effectiveDate) Returns the product configured default value of the attribute identified by this model type attribute.protected StringgetValue(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.org.faktorips.valueset.ValueSet<?>Returns the value set defined in the model for this attribute.booleanReturns true if this attribute is configured by the product.voidremoveValue(IModelObject modelObject) Sets the given model object's attribute identified by this model type attribute to its null-value (nullfor most datatypes, aNullObjectfor theNullObjectSupport-datatypesDecimalandMoney, and an empty string for the datatypeString) This only works for changeable attributes.voidsetDefaultValue(IConfigurableModelObject modelObject, Object defaultValue) Sets the product configured default value of the attribute identified by this model type attribute.voidsetDefaultValue(IProductComponentGeneration target, Object defaultValue) Sets the product configured default value of the attribute identified by this model type attribute.voidsetDefaultValue(IProductComponent source, Calendar effectiveDate, Object defaultValue) Sets the product configured default value of the attribute identified by this model type attribute.voidsetValue(IModelObject modelObject, Object value) Sets the given model object's attribute identified by this model type attribute to the given value.voidsetValueSet(IConfigurableModelObject modelObject, org.faktorips.valueset.ValueSet<?> valueSet) Sets the product configured set of allowed values of the attribute identified by this model type attribute.voidsetValueSet(IProductComponentGeneration target, org.faktorips.valueset.ValueSet<?> valueSet) Sets the product configured set of allowed values of the attribute identified by this model type attribute.voidsetValueSet(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.Methods inherited from class org.faktorips.runtime.model.type.PolicyAttribute
getDefaultValue, getModelType, getSuperAttribute, getType, getValueSet, getValueSet, isEmpty, isValuePresentMethods inherited from class org.faktorips.runtime.model.type.Attribute
findSuperAttribute, getAttributeKind, getDatatype, getDefaultValueFromModel, getDocumentation, getRelevantProductObject, getRelevantProductObject, getValueSetKind, isChangingOverTime, isOverriding, toString, validate, validateMethods inherited from class org.faktorips.runtime.model.type.TypePart
getMessageHelper, getMessageKey, getTypeNameMethods inherited from class org.faktorips.runtime.model.type.ModelElement
createMessageHelper, getDeprecation, getDescription, getExtensionPropertyIds, getExtensionPropertyValue, getLabel, getName, getRelevantProductObject, getRelevantProductObject, invokeField, invokeMethod, isDeprecated
-
Constructor Details
-
ConstantPolicyAttribute
-
-
Method Details
-
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
-
getValue
Description copied from class:PolicyAttributeReturns the value of the given model object's attribute identified by this model type attribute.- Specified by:
getValuein classPolicyAttribute- Parameters:
modelObject- a model object corresponding to theTypethis attribute belongs to- Returns:
- the value of the given model object's attribute identified by this model type attribute
-
setValue
Description copied from class:PolicyAttributeSets the given model object's attribute identified by this model type attribute to the given value. This only works for changeable attributes.- Specified by:
setValuein classPolicyAttribute- Parameters:
modelObject- a model object corresponding to theTypethis attribute belongs tovalue- an object of this model type attribute's datatype
-
removeValue
Description copied from class:PolicyAttributeSets the given model object's attribute identified by this model type attribute to its null-value (nullfor most datatypes, aNullObjectfor theNullObjectSupport-datatypesDecimalandMoney, and an empty string for the datatypeString) This only works for changeable attributes.- Specified by:
removeValuein classPolicyAttribute- Parameters:
modelObject- a model object corresponding to theTypethis attribute belongs to
-
createOverwritingAttributeFor
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
-
getDefaultValue
Description copied from class:PolicyAttributeReturns the (product configured) default value of the attribute identified by this model type attribute. Throws anIllegalStateExceptionif the model object has no default value constant or the product has no getDefaultValue~() method for this attribute.- Specified by:
getDefaultValuein classPolicyAttribute- Parameters:
modelObject- the configurable model object from which product component and (if necessary) effective date can be retrieved- See Also:
-
getDefaultValue
Description copied from class:PolicyAttributeReturns the product configured default value of the attribute identified by this model type attribute.- Specified by:
getDefaultValuein classPolicyAttribute- Parameters:
source- the product component to read the attribute default value from.effectiveDate- the date to determine the product component generation. Ifnullthe latest generation is used. Is ignored if the attribute's configuration is not changing over time.
-
setDefaultValue
Description copied from class:PolicyAttributeSets the product configured default value of the attribute identified by this model type attribute.- Specified by:
setDefaultValuein classPolicyAttribute- Parameters:
modelObject- the configurable model object from which product component and (if necessary) effective date can be retrieveddefaultValue- the new default value
-
setDefaultValue
Description copied from class:PolicyAttributeSets the product configured default value of the attribute identified by this model type attribute.- Specified by:
setDefaultValuein classPolicyAttribute- Parameters:
source- the product component to write the attribute default value toeffectiveDate- the date to determine the product component generation. Ifnullthe latest generation is used. Is ignored if the attribute's configuration is not changing over time.defaultValue- the new default value
-
setDefaultValue
Description copied from class:PolicyAttributeSets the product configured default value of the attribute identified by this model type attribute.- Specified by:
setDefaultValuein classPolicyAttribute- Parameters:
target- the product component generationdefaultValue- the new default value
-
getValueSet
public org.faktorips.valueset.ValueSet<?> getValueSet(IModelObject modelObject, IValidationContext context) Description copied from class:PolicyAttributeReturns the value set of the given model object's attribute identified by this model type attribute.Note: If the
PolicyCmptTypethisPolicyAttributebelongs to defines anUnrestrictedValueSetincludingnull, no method is generated by Faktor-IPS. Therefore, a value set method in a subclass is not found even if theIModelObjectpassed to this method is an instance of that subclass. To make sure to get the correct value set, always useIpsModel.getPolicyCmptType(IModelObject)on the actualIModelObjectinstead ofIpsModel.getPolicyCmptType(Class)on the super class.- Specified by:
getValueSetin classPolicyAttribute- Parameters:
modelObject- a model object
-
getValueSetFromModel
public org.faktorips.valueset.ValueSet<?> getValueSetFromModel()Description copied from class:AttributeReturns the value set defined in the model for this attribute.- Overrides:
getValueSetFromModelin classAttribute
-
getValueSet
public org.faktorips.valueset.ValueSet<?> getValueSet(IProductComponent source, Calendar effectiveDate, IValidationContext context) Description copied from class:PolicyAttributeReturns the value set of the given model object's attribute identified by this model type attribute. Returns anUnrestrictedValueSetif there is no method that returns a value set for this attribute.- Specified by:
getValueSetin classPolicyAttribute- Parameters:
source- the product component to read an attribute value set from. Must correspond to theTypethis attribute belongs to.effectiveDate- the date to determine the product component generation. Ifnullthe latest generation is used. Is ignored if the attribute's configuration is not changing over time.
-
setValueSet
public void setValueSet(IProductComponent source, Calendar effectiveDate, org.faktorips.valueset.ValueSet<?> valueSet) Description copied from class:PolicyAttributeSets the product configured set of allowed values of the attribute identified by this model type attribute.Caution: as generics are erased at runtime, it is possible to set a
ValueSetof a mismatched type with this method, for example anOrderedValueSet<String>for an attribute withAttribute.getDatatype()Integer, which will result in aClassCastExceptionon later method calls.- Specified by:
setValueSetin classPolicyAttribute- Parameters:
source- the product component to write the attribute value set to. Must correspond to theTypethis attribute belongs to.effectiveDate- the date to determine the product component generation. Ifnullthe latest generation is used. Is ignored if the attribute's configuration is not changing over time.valueSet- the new value set
-
setValueSet
public void setValueSet(IConfigurableModelObject modelObject, org.faktorips.valueset.ValueSet<?> valueSet) Description copied from class:PolicyAttributeSets the product configured set of allowed values of the attribute identified by this model type attribute.Caution: as generics are erased at runtime, it is possible to set a
ValueSetof a mismatched type with this method, for example anOrderedValueSet<String>for an attribute withAttribute.getDatatype()Integer, which will result in aClassCastExceptionon later method calls.- Specified by:
setValueSetin classPolicyAttribute- Parameters:
modelObject- the configurable model object from which product component and (if necessary) effective date can be retrievedvalueSet- the new value set
-
setValueSet
public void setValueSet(IProductComponentGeneration target, org.faktorips.valueset.ValueSet<?> valueSet) Description copied from class:PolicyAttributeSets the product configured set of allowed values of the attribute identified by this model type attribute.Caution: as generics are erased at runtime, it is possible to set a
ValueSetof a mismatched type with this method, for example anOrderedValueSet<String>for an attribute withAttribute.getDatatype()Integer, which will result in aClassCastExceptionon later method calls.- Specified by:
setValueSetin classPolicyAttribute- Parameters:
target- the product component generation, which will be used to write the attribute value set to the corresponding product component to.valueSet- the new value set
-
getResourceBundleName
- Specified by:
getResourceBundleNamein classAttribute
-