Class ColumnIdentifier

java.lang.Object
org.apache.cassandra.cql3.ColumnIdentifier
All Implemented Interfaces:
Comparable<ColumnIdentifier>, IMeasurableMemory

public class ColumnIdentifier extends Object implements IMeasurableMemory, Comparable<ColumnIdentifier>
Represents an identifer for a CQL column definition. TODO : should support light-weight mode without text representation for when not interned
  • Field Details

    • bytes

      public final ByteBuffer bytes
    • prefixComparison

      public final long prefixComparison
      since these objects are compared frequently, we stash an efficiently compared prefix of the bytes, in the expectation that the majority of comparisons can be answered by this value only
  • Constructor Details

    • ColumnIdentifier

      public ColumnIdentifier(String rawText, boolean keepCase)
    • ColumnIdentifier

      public ColumnIdentifier(ByteBuffer bytes, AbstractType<?> type)
    • ColumnIdentifier

      public ColumnIdentifier(ByteBuffer bytes, String text)
  • Method Details

    • getInterned

      public static ColumnIdentifier getInterned(ByteBuffer bytes, AbstractType<?> type)
    • getInterned

      public static ColumnIdentifier getInterned(String rawText, boolean keepCase)
    • getInterned

      public static ColumnIdentifier getInterned(AbstractType<?> type, ByteBuffer bytes, String text)
    • isInterned

      public boolean isInterned()
    • hashCode

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

      public final boolean equals(Object o)
      Overrides:
      equals in class Object
    • toString

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

      public String toCQLString()
      Returns a string representation of the identifier that is safe to use directly in CQL queries. If necessary, the string will be double-quoted, and any quotes inside the string will be escaped.
    • unsharedHeapSize

      public long unsharedHeapSize()
      Specified by:
      unsharedHeapSize in interface IMeasurableMemory
      Returns:
      the amount of on-heap memory retained by the object that might be reclaimed if the object were reclaimed, i.e. it should try to exclude globally cached data where possible, or counting portions of arrays that are referenced by the object but used by other objects only (e.g. slabbed byte-buffers), etc.
    • unsharedHeapSizeExcludingData

      public long unsharedHeapSizeExcludingData()
    • clone

      public ColumnIdentifier clone(ByteBufferCloner cloner)
    • compareTo

      public int compareTo(ColumnIdentifier that)
      Specified by:
      compareTo in interface Comparable<ColumnIdentifier>
    • maybeQuote

      public static String maybeQuote(String text)