Class ConstantPolicyAttribute

    • Constructor Detail

      • ConstantPolicyAttribute

        public ConstantPolicyAttribute​(Type type,
                                       java.lang.reflect.Field field,
                                       boolean changingOverTime)
    • Method Detail

      • isProductRelevant

        public boolean isProductRelevant()
        Description copied from class: Attribute
        Returns true if this attribute is configured by the product. Product attributes are always product relevant.
        Specified by:
        isProductRelevant in class Attribute
        Returns:
        true if this attribute is configured by the product, false if not
      • getValue

        public java.lang.Object getValue​(IModelObject modelObject)
        Description copied from class: PolicyAttribute
        Returns the value of the given model object's attribute identified by this model type attribute.
        Specified by:
        getValue in class PolicyAttribute
        Parameters:
        modelObject - a model object corresponding to the Type this attribute belongs to
        Returns:
        the value of the given model object's attribute identified by this model type attribute
      • setValue

        public void setValue​(IModelObject modelObject,
                             java.lang.Object value)
        Description copied from class: PolicyAttribute
        Sets the given model object's attribute identified by this model type attribute to the given value. This only works for changeable attributes.
        Specified by:
        setValue in class PolicyAttribute
        Parameters:
        modelObject - a model object corresponding to the Type this attribute belongs to
        value - an object of this model type attribute's datatype
      • removeValue

        public void removeValue​(IModelObject modelObject)
        Description copied from class: PolicyAttribute
        Sets the given model object's attribute identified by this model type attribute to its null-value (null for most datatypes, a NullObject for the NullObjectSupport-datatypes Decimal and Money, and an empty string for the datatype String) This only works for changeable attributes.
        Specified by:
        removeValue in class PolicyAttribute
        Parameters:
        modelObject - a model object corresponding to the Type this attribute belongs to
      • createOverwritingAttributeFor

        public ConstantPolicyAttribute createOverwritingAttributeFor​(Type subType)
        Description copied from class: Attribute
        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.
        Specified by:
        createOverwritingAttributeFor in class Attribute
        Parameters:
        subType - a model type representing a sub type of this attribute's model type
        Returns:
        a Attribute for the given sub model type
      • getDefaultValue

        public java.lang.Object getDefaultValue​(IModelObject modelObject)
        Description copied from class: PolicyAttribute
        Returns the (product configured) default value of the attribute identified by this model type attribute. Throws an IllegalStateException if the model object has no default value constant or the product has no getDefaultValue~() method for this attribute.
        Specified by:
        getDefaultValue in class PolicyAttribute
        Parameters:
        modelObject - the configurable model object from which product component and (if necessary) effective date can be retrieved
        See Also:
        PolicyAttribute.getDefaultValue(IProductComponent, Calendar)
      • getDefaultValue

        public java.lang.Object getDefaultValue​(IProductComponent source,
                                                java.util.Calendar effectiveDate)
        Description copied from class: PolicyAttribute
        Returns the product configured default value of the attribute identified by this model type attribute.
        Specified by:
        getDefaultValue in class PolicyAttribute
        Parameters:
        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.
      • setDefaultValue

        public void setDefaultValue​(IConfigurableModelObject modelObject,
                                    java.lang.Object defaultValue)
        Description copied from class: PolicyAttribute
        Sets the product configured default value of the attribute identified by this model type attribute.
        Specified by:
        setDefaultValue in class PolicyAttribute
        Parameters:
        modelObject - the configurable model object from which product component and (if necessary) effective date can be retrieved
        defaultValue - the new default value
      • setDefaultValue

        public void setDefaultValue​(IProductComponent source,
                                    java.util.Calendar effectiveDate,
                                    java.lang.Object defaultValue)
        Description copied from class: PolicyAttribute
        Sets the product configured default value of the attribute identified by this model type attribute.
        Specified by:
        setDefaultValue in class PolicyAttribute
        Parameters:
        source - the product component to write the attribute default value 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.
        defaultValue - the new default value
      • getValueSet

        public org.faktorips.valueset.ValueSet<?> getValueSet​(IProductComponent source,
                                                              java.util.Calendar effectiveDate,
                                                              IValidationContext context)
        Description copied from class: PolicyAttribute
        Returns the value set of the given model object's attribute identified by this model type attribute. Returns an UnrestrictedValueSet if there is no method that returns a value set for this attribute.
        Specified by:
        getValueSet in class PolicyAttribute
        Parameters:
        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.
      • setValueSet

        public void setValueSet​(IProductComponent source,
                                java.util.Calendar effectiveDate,
                                org.faktorips.valueset.ValueSet<?> valueSet)
        Description copied from class: PolicyAttribute
        Sets 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 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.

        Specified by:
        setValueSet in class PolicyAttribute
        Parameters:
        source - 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 set
      • setValueSet

        public void setValueSet​(IConfigurableModelObject modelObject,
                                org.faktorips.valueset.ValueSet<?> valueSet)
        Description copied from class: PolicyAttribute
        Sets 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 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.

        Specified by:
        setValueSet in class PolicyAttribute
        Parameters:
        modelObject - the configurable model object from which product component and (if necessary) effective date can be retrieved
        valueSet - the new value set