Class SimpleNodeAttribute

  • All Implemented Interfaces:
    NodeAttribute

    public class SimpleNodeAttribute
    extends java.lang.Object
    implements NodeAttribute
    Implementation of the NodeAttribute interface
    Author:
    Abhishek Sanoujam
    • Constructor Detail

      • SimpleNodeAttribute

        public SimpleNodeAttribute​(java.lang.String name)
        Constructor accepting the name of the attribute
        Parameters:
        name - the name of the attribute
      • SimpleNodeAttribute

        public SimpleNodeAttribute​(java.lang.String name,
                                   java.lang.Enum value)
        Constructor accepting name and Enum value of the attribute
        Parameters:
        name - the name of the attribute
        value - the Enum value of the attribute
      • SimpleNodeAttribute

        public SimpleNodeAttribute​(java.lang.String name,
                                   int value)
        Constructor accepting name and int value of the attribute
        Parameters:
        name - the name of the attribute
        value - the int value of the attribute
      • SimpleNodeAttribute

        public SimpleNodeAttribute​(java.lang.String name,
                                   long value)
        Constructor accepting name and long value of the attribute
        Parameters:
        name - the name of the attribute
        value - the long value of the attribute
      • SimpleNodeAttribute

        public SimpleNodeAttribute​(java.lang.String name,
                                   boolean value)
        Constructor accepting name and boolean value of the attribute
        Parameters:
        name - the name of the attribute
        value - the boolean value of the attribute
      • SimpleNodeAttribute

        public SimpleNodeAttribute​(java.lang.String name,
                                   java.lang.String value)
        Constructor accepting name and String value of the attribute
        Parameters:
        name - the name of the attribute
        value - the String value of the attribute
    • Method Detail

      • getName

        public java.lang.String getName()
        Name of the attribute
        Specified by:
        getName in interface NodeAttribute
        Returns:
        Name of the attribute
      • getValue

        public java.lang.String getValue()
        Value of the attribute
        Specified by:
        getValue in interface NodeAttribute
        Returns:
        value of the attribute
      • isOptional

        public boolean isOptional()
        Returns true if the attribute is optional, otherwise false
        Specified by:
        isOptional in interface NodeAttribute
        Returns:
        Returns true if the attribute is optional, otherwise false
      • setOptional

        public void setOptional​(boolean optional)
        Sets this attribute to optional or not
        Specified by:
        setOptional in interface NodeAttribute
        Parameters:
        optional - true if this attribute is optional
      • getDefaultValue

        public java.lang.String getDefaultValue()
        Returns the default value of the attribute
        Specified by:
        getDefaultValue in interface NodeAttribute
        Returns:
        default value of the attribute
      • setDefaultValue

        public void setDefaultValue​(java.lang.String defaultValue)
        Default value setter
        Specified by:
        setDefaultValue in interface NodeAttribute
        Parameters:
        defaultValue - the default value
      • setValue

        public void setValue​(java.lang.String value)
        Setter for value
        Specified by:
        setValue in interface NodeAttribute
        Parameters:
        value - the new value
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • optional

        public SimpleNodeAttribute optional​(boolean optional)
        Builder convenience method for setting optional
        Specified by:
        optional in interface NodeAttribute
        Parameters:
        optional - true if optional
        Returns:
        the same attribute instance
      • defaultValue

        public SimpleNodeAttribute defaultValue​(java.lang.String defaultValue)
        Builder convenience method for setting defaultValue
        Specified by:
        defaultValue in interface NodeAttribute
        Parameters:
        defaultValue - the default value
        Returns:
        the same attribute instance
      • defaultValue

        public SimpleNodeAttribute defaultValue​(boolean defaultValue)
        Same as defaultValue(String) using String.valueOf(defaultValue)
        Parameters:
        defaultValue - the default value
        Returns:
        the same instance
      • defaultValue

        public SimpleNodeAttribute defaultValue​(int defaultValue)
        Same as defaultValue(String) using String.valueOf(defaultValue)
        Parameters:
        defaultValue - the default value
        Returns:
        the same instance
      • defaultValue

        public SimpleNodeAttribute defaultValue​(java.lang.Enum defaultValue)
        Same as defaultValue(String) using String.valueOf(defaultValue)
        Parameters:
        defaultValue - the default value
        Returns:
        the same instance
      • defaultValue

        public SimpleNodeAttribute defaultValue​(long defaultValue)
        Same as defaultValue(String) using String.valueOf(defaultValue)
        Parameters:
        defaultValue - the default value
        Returns:
        the same instance