Class ModelObjectAttribute

    • Method Detail

      • getValue

        public java.lang.Object getValue()
        Returns the value of the this model object attribute.
        Throws:
        java.lang.IllegalArgumentException - if the attribute is not accessible for any reason
        See Also:
        PolicyAttribute.getValue(IModelObject)
      • removeValue

        public ModelObjectAttribute removeValue()
        Sets the model object attribute to its null-value (null for most datatypes, a NullObject for for the NullObjectSupport-datatypes Decimal and Money, and an empty string for the datatype String) This only works for changeable attributes.
        Returns:
        this ModelObjectAttribute, to allow method chaining.
        Throws:
        java.lang.IllegalArgumentException - if the model object attribute is not accessible for any reason.
        java.lang.UnsupportedOperationException - if invoked on a AttributeKind.CONSTANT attribute.
        See Also:
        PolicyAttribute.removeValue(IModelObject)
      • getValueSet

        public org.faktorips.valueset.ValueSet<?> getValueSet()
        Returns the set of values allowed for this model object attribute.
        Throws:
        java.lang.UnsupportedOperationException - if invoked on a AttributeKind.CONSTANT attribute.
        java.lang.IllegalStateException - if the method that should return a value set for this attribute has too many arguments
        java.lang.IllegalArgumentException - if the invocation of the method that should return a value set for this attribute fails for any reason
        See Also:
        PolicyAttribute.getValueSet(IModelObject)
      • setValueSet

        public ModelObjectAttribute setValueSet​(org.faktorips.valueset.ValueSet<?> valueSet)
        Sets the product configured set of allowed values of this model object 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 datatype Integer, which will result in a ClassCastException on later method calls.

        Parameters:
        valueSet - the new value set
        Returns:
        this ModelObjectAttribute, to allow method chaining.
        Throws:
        java.lang.UnsupportedOperationException - if invoked on a AttributeKind.CONSTANT attribute.
        java.lang.ClassCastException - if the type of value set does not match the property's configuration or the model object is no IConfigurableModelObject.
        java.lang.IllegalStateException - 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.
        java.lang.IllegalArgumentException - if the invocation of the method that should set the value set for this attribute fails for any reason
        See Also:
        PolicyAttribute.setValueSet(IConfigurableModelObject, ValueSet)
      • getDefaultValue

        public java.lang.Object getDefaultValue()
        Returns the product configured default value of the attribute identified by this model object attribute. Throws an 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.
        Throws:
        java.lang.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.
        java.lang.IllegalArgumentException - if the invocation of the method that should get the default value for this attribute fails for any reason
        java.lang.ClassCastException - if the model object is no IConfigurableModelObject.
        See Also:
        PolicyAttribute.getDefaultValue(IConfigurableModelObject)
      • setDefaultValue

        public ModelObjectAttribute setDefaultValue​(java.lang.Object defaultValue)
        Sets the product configured default value of this attribute. necessary) effective date can be retrieved
        Parameters:
        defaultValue - the new default value
        Returns:
        this ModelObjectAttribute, to allow method chaining.
        Throws:
        java.lang.UnsupportedOperationException - if invoked on a AttributeKind.CONSTANT attribute.
        java.lang.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.
        java.lang.IllegalArgumentException - if the invocation of the method that should set the default value for this attribute fails for any reason
        java.lang.ClassCastException - if the model object is no IConfigurableModelObject.
        See Also:
        PolicyAttribute.setDefaultValue(IConfigurableModelObject, Object)