java.lang.Object
org.apache.qpid.protonj2.types.Symbol
All Implemented Interfaces:
Comparable<Symbol>

public final class Symbol extends Object implements 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 Details

    • getLength

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

      public ProtonBuffer toASCII()
      Returns:
      a read-only view of the Symbol as a buffer of ASCII bytes.
    • compareTo

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

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

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

      public boolean equals(Object other)
      Overrides:
      equals in class 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(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(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.
    • getSASLSymbol

      public static Symbol getSASLSymbol(ProtonBuffer symbolBytes)
      Look up a singleton Symbol instance that matches the given ProtonBuffer byte view of the Symbol from the smaller SASL Symbol cache. The symbols returned here are meant to only be those used in the SASL exchange during connection establishment..
      Parameters:
      symbolBytes - The String version of the Symbol value.
      Returns:
      a Symbol that matches the given String.
    • getSASLSymbol

      public static Symbol getSASLSymbol(ProtonBuffer symbolBuffer, boolean copyOnCreate)
      Look up a singleton Symbol instance that matches the given ProtonBuffer byte view of the Symbol from the smaller SASL Symbol cache. The symbols returned here are meant to only be those used in the SASL exchange during connection establishment..
      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.
    • getSASLSymbol

      public static Symbol getSASLSymbol(String stringValue)
      Look up a singleton Symbol instance that matches the given String name of the Symbol from the smaller SASL Symbol cache. The symbols returned here are meant to only be those used in the SASL exchange during connection establishment..
      Parameters:
      stringValue - The String version of the Symbol value.
      Returns:
      a Symbol that matches the given String.