Class Symbol

  • All Implemented Interfaces:
    java.lang.Comparable<Symbol>

    public final class Symbol
    extends java.lang.Object
    implements java.lang.Comparable<Symbol>
    Class that represents an AMQP Symbol value. The creation of a Symbol object occurs during a lookup operation which cannot find an already stored version of the string or byte buffer view of the Symbol's ASCII bytes.
    • Method Detail

      • getLength

        public int getLength()
        Returns:
        the number of bytes that comprise the Symbol value.
      • compareTo

        public int compareTo​(Symbol other)
        Specified by:
        compareTo in interface java.lang.Comparable<Symbol>
      • toString

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

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

        public boolean equals​(java.lang.Object other)
        Overrides:
        equals in class java.lang.Object
      • writeTo

        public void writeTo​(ProtonBuffer target)
        Writes the internal Symbol bytes to the provided ProtonBuffer. This is a raw ASCII encoding of the Symbol without and AMQP type encoding.
        Parameters:
        target - The buffer where the Symbol bytes should be written to.
      • valueOf

        public static Symbol valueOf​(java.lang.String symbolVal)
        Look up a singleton Symbol instance that matches the given String name of the Symbol.
        Parameters:
        symbolVal - The String version of the Symbol value.
        Returns:
        a Symbol that matches the given String.
      • getSymbol

        public static Symbol getSymbol​(ProtonBuffer symbolBytes)
        Look up a singleton Symbol instance that matches the given ProtonBuffer byte view of the Symbol.
        Parameters:
        symbolBytes - The String version of the Symbol value.
        Returns:
        a Symbol that matches the given String.
      • getSymbol

        public static Symbol getSymbol​(ProtonBuffer symbolBuffer,
                                       boolean copyOnCreate)
        Look up a singleton Symbol instance that matches the given ProtonBuffer byte view of the Symbol.
        Parameters:
        symbolBuffer - The ProtonBuffer version of the Symbol value.
        copyOnCreate - Should the provided buffer be copied during creation of a new Symbol.
        Returns:
        a Symbol that matches the given String.
      • getSymbol

        public static Symbol getSymbol​(java.lang.String stringValue)
        Look up a singleton Symbol instance that matches the given String name of the Symbol.
        Parameters:
        stringValue - The String version of the Symbol value.
        Returns:
        a Symbol that matches the given String.