Package cdc.util.data

Class Attribute


  • public final class Attribute
    extends Object
    XML like attribute ([name, value] pair).

    An attribute name can not be changed after creation. Its value can be modified.

    Author:
    Damien Carbonne
    • Field Detail

      • NAME_COMPARATOR

        public static final Comparator<Attribute> NAME_COMPARATOR
        A Comparator of attributes that compares names.
    • Constructor Detail

      • Attribute

        public Attribute​(String name)
      • Attribute

        public Attribute​(Attribute other)
      • Attribute

        public Attribute​(String name,
                         Object value)
      • Attribute

        public Attribute​(String name,
                         E value)
      • Attribute

        public Attribute​(String name,
                         String value)
      • Attribute

        public Attribute​(String name,
                         boolean value)
      • Attribute

        public Attribute​(String name,
                         long value)
      • Attribute

        public Attribute​(String name,
                         int value)
      • Attribute

        public Attribute​(String name,
                         short value)
      • Attribute

        public Attribute​(String name,
                         byte value)
      • Attribute

        public Attribute​(String name,
                         double value)
      • Attribute

        public Attribute​(String name,
                         float value)
    • Method Detail

      • setValue

        public void setValue​(Object value)
      • setValue

        public void setValue​(String value)
      • setValue

        public void setValue​(boolean value)
      • setValue

        public void setValue​(long value)
      • setValue

        public void setValue​(int value)
      • setValue

        public void setValue​(short value)
      • setValue

        public void setValue​(byte value)
      • setValue

        public void setValue​(double value)
      • setValue

        public void setValue​(float value)
      • setValue

        public <E extends Enum<E>> void setValue​(E value)
      • getName

        public String getName()
      • getValue

        public String getValue()
      • getValueAsBoolean

        public boolean getValueAsBoolean()
      • getValueAsLong

        public long getValueAsLong()
      • getValueAsInt

        public int getValueAsInt()
      • getValueAsShort

        public short getValueAsShort()
      • getValueAsByte

        public byte getValueAsByte()
      • getValueAsDouble

        public double getValueAsDouble()
      • getValueAsFloat

        public float getValueAsFloat()
      • getValueAsEnum

        public <E extends Enum<E>> E getValueAsEnum​(Class<E> enumClass)
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • named

        public static Predicate<Attribute> named​(String name)
        Creates a Predicate that accepts Attributes with a given name.
        Parameters:
        name - The name.
        Returns:
        A new Predicate that accepts Attributes that are named name.
      • named

        public static Predicate<Attribute> named​(Set<String> names)
        Creates a Predicate that accepts Attributes with a name belonging to a set.
        Parameters:
        names - The names.
        Returns:
        A new Predicate that accepts Attributes whose name belongs to names.
      • named

        public static Predicate<Attribute> named​(String... names)
        Creates a Predicate that accepts Attributes with a name belonging to an array.
        Parameters:
        names - The names.
        Returns:
        A new Predicate that accepts Attributes whose name belongs to names.