Class Attribute


  • public class Attribute
    extends java.lang.Object
    An Attribute consists of an attribute by name, type and list of value(s). An attribute should be uniquely identified by its name and type. The name is considered as required.
    • Constructor Summary

      Constructors 
      Constructor Description
      Attribute​(java.lang.String name, java.lang.String type, java.lang.String value)
      Construct an attribute based on it's name, type and a single string values.
      Attribute​(java.lang.String name, java.lang.String type, java.lang.String[] values)
      Construct an attribute based on it's name, type and an array of values.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String getName()
      Returns the name of the attribute
      java.lang.String getType()
      Returns the attribute type string.
      java.lang.String getValue()
      Returns the first string value for the attribute if any.
      java.util.List<java.lang.String> getValues()
      The list of string values.
      java.lang.String[] getValuesArray()
      The string values as an immutable array.
      void setValues​(java.lang.String[] values)
      Resets the values of the attribute to the list of strings in the passed array.
      java.lang.String toString()
      String representation of an attribute useful for debug tracing
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • Attribute

        public Attribute​(java.lang.String name,
                         java.lang.String type,
                         java.lang.String[] values)
        Construct an attribute based on it's name, type and an array of values. Name should be non-null, type is optional and can be null. The values may be empty/null.
        Parameters:
        name - name of the attribute to construct
        type - type of attribute - typically a URN
        values - array of String values
      • Attribute

        public Attribute​(java.lang.String name,
                         java.lang.String type,
                         java.lang.String value)
        Construct an attribute based on it's name, type and a single string values. Name should be non-null, type is optional and can be null. The values may be empty/null.
        Parameters:
        name - name of the attribute to construct
        type - type of attribute - typically a URN
        value - single String value
    • Method Detail

      • getName

        public java.lang.String getName()
        Returns the name of the attribute
        Returns:
        name of attribute
      • getType

        public java.lang.String getType()
        Returns the attribute type string. May be null if no type was specified
        Returns:
        type string for the attribute
      • getValues

        public java.util.List<java.lang.String> getValues()
        The list of string values. This List is returned by reference so any modifications to the list also modify the attribute.
        Returns:
        reference to list of string values of the attribute. If the attribute has no values, an empty list is returned.
      • getValuesArray

        public java.lang.String[] getValuesArray()
        The string values as an immutable array.
        Returns:
        array of string values of the attribute. If the attribute has no values, an empty array is returned.
      • getValue

        public java.lang.String getValue()
        Returns the first string value for the attribute if any. If the list has no values, null is returned.
        Returns:
      • setValues

        public void setValues​(java.lang.String[] values)
        Resets the values of the attribute to the list of strings in the passed array. All existing values are removed.
        Parameters:
        values - new list of values for the attribute
      • toString

        public java.lang.String toString()
        String representation of an attribute useful for debug tracing
        Overrides:
        toString in class java.lang.Object