Class StringValue

  • All Implemented Interfaces:
    Value

    public class StringValue
    extends BaseValue
    A StringValue provides an implementation of the Value interface representing a string value.
    • Constructor Detail

      • StringValue

        public StringValue​(String text)
        Constructs a StringValue object representing a string.
        Parameters:
        text - the string this StringValue should represent
    • Method Detail

      • equals

        public boolean equals​(Object obj)
        Indicates whether some other object is "equal to" this one.

        The result is true if and only if the argument is not null and is a StringValue object that represents the same value as this object.

        Overrides:
        equals in class Object
        Parameters:
        obj - the reference object with which to compare.
        Returns:
        true if this object is the same as the obj argument; false otherwise.
      • hashCode

        public int hashCode()
        Returns zero to satisfy the Object equals/hashCode contract. This class is mutable and not meant to be used as a hash key.
        Overrides:
        hashCode in class Object
        Returns:
        always zero
        See Also:
        Object.hashCode()
      • getInternalString

        protected String getInternalString()
                                    throws ValueFormatException
        Returns the internal string representation of this value without modifying the value state.
        Specified by:
        getInternalString in class BaseValue
        Returns:
        the internal string representation
        Throws:
        ValueFormatException - if the value can not be represented as a String or if the value is null.