Class ReadonlyAttributeDecorator

  • All Implemented Interfaces:
    Attribute, Property

    public final class ReadonlyAttributeDecorator
    extends Object
    implements Attribute
    Readonly wrapper around the provided Attribute.

    This class is used by Types in order to protect provided attributes from modification during evaluation.

    • Constructor Detail

      • ReadonlyAttributeDecorator

        public ReadonlyAttributeDecorator​(Attribute delegate)
    • Method Detail

      • getIdentifier

        public Identifier getIdentifier()
        Description copied from interface: Attribute
        Unique Identifier for the attribute.

        This value is non-null in the case that getType().isIdentifiable() is true.

        Specified by:
        getIdentifier in interface Attribute
        Returns:
        A unique identifier for the attribute, or null if the attribute is non-identifiable.
      • getValue

        public Object getValue()
        Description copied from interface: Property
        The value or content of the property.

        The class of this object is defined by getType().getBinding().

        This value may be null. In this case getDescriptor().isNillable() would be true.

        Specified by:
        getValue in interface Property
        Returns:
        The value of the property.
      • setValue

        public void setValue​(Object newValue)
                      throws IllegalArgumentException
        Description copied from interface: Property
        Sets the value or content of the property.

        The class of newValue should be the same as or a subclass of getType().getBinding().

        newValue may be null if getDescriptor().isNillable() is true.

        Specified by:
        setValue in interface Property
        Parameters:
        newValue - The new value of the property.
        Throws:
        IllegalArgumentException
      • getName

        public Name getName()
        Description copied from interface: Property
        The name of the property with respect to its descriptor.

        This method is convenience for getDescriptor().getName().

        Specified by:
        getName in interface Property
        Returns:
        name of the property.
      • getUserData

        public Map<Object,​Object> getUserData()
        Description copied from interface: Property
        A map of "user data" which enables applications to store "application-specific" information against a property.

        An example of information that may wish to be stored along with an attribute could be its srs information (in the case of a geometric attribute ).

         
          GeometryAttribute attribute = ...;
        
          //set the crs
          CoordinateReferenceSystem crs = CRS.decode("EPSG:4326");
          attribute.setCRS( crs );
        
          //set the srs
          attribute.getUserData().put( "srs", "EPSG:4326" );
         
         
        Specified by:
        getUserData in interface Property
        Returns:
        A map of user data.
      • isNillable

        public boolean isNillable()
        Description copied from interface: Property
        Flag indicating if null is an acceptable value for the property.

        This method is convenience for getDescriptor().isNillable().

        Specified by:
        isNillable in interface Property
        Returns:
        true if the value of the property is allowed to be null, otherwise false.
      • validate

        public void validate()
        Description copied from interface: Attribute
        Check the attribute value against the constraints provided by the AttributeDescriptor.

        Please note this method checks the value only - it should have the correct java binding, it should only be null if isNillable is true; and if a value is provided it should satisfy all of the restrictions provided.

        To check the the number of times an attribute is used (minOccurs and maxOccurs) please use ComplexAttribute.validate().

        Specified by:
        validate in interface Attribute