org.apache.cassandra.db.marshal
Class CollectionType<T>

java.lang.Object
  extended by org.apache.cassandra.db.marshal.AbstractType<T>
      extended by org.apache.cassandra.db.marshal.CollectionType<T>
All Implemented Interfaces:
java.util.Comparator<java.nio.ByteBuffer>
Direct Known Subclasses:
ListType, MapType, SetType

public abstract class CollectionType<T>
extends AbstractType<T>

The abstract validator that is the base for maps, sets and lists. Please note that this comparator shouldn't be used "manually" (through thrift for instance).


Nested Class Summary
static class CollectionType.Kind
           
 
Field Summary
 CollectionType.Kind kind
           
 
Fields inherited from class org.apache.cassandra.db.marshal.AbstractType
columnComparator, columnReverseComparator, indexComparator, indexReverseComparator, onDiskAtomComparator, reverseComparator
 
Constructor Summary
protected CollectionType(CollectionType.Kind kind)
           
 
Method Summary
protected abstract  void appendToStringBuilder(java.lang.StringBuilder sb)
           
 CQL3Type asCQL3Type()
           
 int compare(java.nio.ByteBuffer o1, java.nio.ByteBuffer o2)
           
 java.nio.ByteBuffer fromString(java.lang.String source)
          get a byte representation of the given string.
 java.lang.String getString(java.nio.ByteBuffer bytes)
          get a string representation of the bytes suitable for log messages
 boolean isCollection()
           
abstract  AbstractType<?> nameComparator()
           
static java.nio.ByteBuffer pack(java.util.List<java.nio.ByteBuffer> buffers, int elements)
           
protected static java.nio.ByteBuffer pack(java.util.List<java.nio.ByteBuffer> buffers, int elements, int size)
           
abstract  java.nio.ByteBuffer serialize(java.util.List<Pair<java.nio.ByteBuffer,IColumn>> columns)
           
 java.lang.String toString()
          This must be overriden by subclasses if necessary so that for any AbstractType, this == TypeParser.parse(toString()).
 void validate(java.nio.ByteBuffer bytes)
           
abstract  AbstractType<?> valueComparator()
           
 
Methods inherited from class org.apache.cassandra.db.marshal.AbstractType
compareCollectionMembers, compose, decompose, fromStringCQL2, getColumnsString, getReverseComparator, getString, isCommutative, isCompatibleWith, parseDefaultParameters, validateCollectionMember
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Comparator
equals
 

Field Detail

kind

public final CollectionType.Kind kind
Constructor Detail

CollectionType

protected CollectionType(CollectionType.Kind kind)
Method Detail

nameComparator

public abstract AbstractType<?> nameComparator()

valueComparator

public abstract AbstractType<?> valueComparator()

appendToStringBuilder

protected abstract void appendToStringBuilder(java.lang.StringBuilder sb)

serialize

public abstract java.nio.ByteBuffer serialize(java.util.List<Pair<java.nio.ByteBuffer,IColumn>> columns)

toString

public java.lang.String toString()
Description copied from class: AbstractType
This must be overriden by subclasses if necessary so that for any AbstractType, this == TypeParser.parse(toString()). Note that for backwards compatibility this includes the full classname. For CQL purposes the short name is fine.

Overrides:
toString in class AbstractType<T>

compare

public int compare(java.nio.ByteBuffer o1,
                   java.nio.ByteBuffer o2)

getString

public java.lang.String getString(java.nio.ByteBuffer bytes)
Description copied from class: AbstractType
get a string representation of the bytes suitable for log messages

Specified by:
getString in class AbstractType<T>

fromString

public java.nio.ByteBuffer fromString(java.lang.String source)
Description copied from class: AbstractType
get a byte representation of the given string.

Specified by:
fromString in class AbstractType<T>

validate

public void validate(java.nio.ByteBuffer bytes)
Specified by:
validate in class AbstractType<T>

isCollection

public boolean isCollection()
Overrides:
isCollection in class AbstractType<T>

pack

protected static java.nio.ByteBuffer pack(java.util.List<java.nio.ByteBuffer> buffers,
                                          int elements,
                                          int size)

pack

public static java.nio.ByteBuffer pack(java.util.List<java.nio.ByteBuffer> buffers,
                                       int elements)

asCQL3Type

public CQL3Type asCQL3Type()
Overrides:
asCQL3Type in class AbstractType<T>


Copyright © 2013 The Apache Software Foundation