org.apache.cassandra.db.marshal

## Class CompositeType

- java.lang.Object
- - org.apache.cassandra.db.marshal.AbstractType<java.nio.ByteBuffer>
  - - org.apache.cassandra.db.marshal.AbstractCompositeType
    - - org.apache.cassandra.db.marshal.CompositeType

All Implemented Interfaces:
  java.util.Comparator<java.nio.ByteBuffer>, AssignmentTestable

    public class CompositeType
    extends AbstractCompositeType

### Nested Class Summary

Nested Classes
`static class` `CompositeType.Builder`

### Nested classes/interfaces inherited from class org.apache.cassandra.db.marshal.AbstractCompositeType

`AbstractCompositeType.ParsedComparator`

### Nested classes/interfaces inherited from class org.apache.cassandra.db.marshal.AbstractType

`AbstractType.ComparisonType`

### Nested classes/interfaces inherited from interface org.apache.cassandra.cql3.AssignmentTestable

`AssignmentTestable.TestResult`

### Field Summary

Fields
`static int` `STATIC_MARKER`
`java.util.List<AbstractType<?>>` `types`

### Fields inherited from class org.apache.cassandra.db.marshal.AbstractType

`comparisonType, isByteOrderComparable, reverseComparator`

### Constructor Summary

Constructors
`protected` `CompositeType(java.util.List<AbstractType<?>> types)`

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`static java.nio.ByteBuffer` `build(boolean isStatic, java.nio.ByteBuffer... buffers)`
`static java.nio.ByteBuffer` `build(java.nio.ByteBuffer... buffers)`
`CompositeType.Builder` `builder()`
`int` `componentsCount()` The number of subcomponents this type has.
`java.nio.ByteBuffer` `decompose(java.lang.Object... objects)`
`static java.nio.ByteBuffer` `extractComponent(java.nio.ByteBuffer bb, int idx)`
`java.nio.ByteBuffer` `extractLastComponent(java.nio.ByteBuffer bb)`
`protected AbstractType<?>` `getAndAppendComparator(int i, java.nio.ByteBuffer bb, java.lang.StringBuilder sb)` Adds type information from @param bb to @param sb.
`protected AbstractType<?>` `getComparator(int i, java.nio.ByteBuffer bb)`
`protected AbstractType<?>` `getComparator(int i, java.nio.ByteBuffer bb1, java.nio.ByteBuffer bb2)` Adds DynamicCompositeType type information from @param bb1 to @param bb2.
`java.util.List<AbstractType<?>>` `getComponents()` Return a list of the "subcomponents" this type has.
`static CompositeType` `getInstance(AbstractType... types)`
`static CompositeType` `getInstance(java.util.List<AbstractType<?>> types)`
`static CompositeType` `getInstance(TypeParser parser)`
`boolean` `isCompatibleWith(AbstractType<?> previous)` Returns true if this comparator is compatible with the provided previous comparator, that is if previous can safely be replaced by this.
`static boolean` `isStaticName(java.nio.ByteBuffer bb)`
`boolean` `isValueCompatibleWithInternal(AbstractType<?> otherType)` Needed to handle ReversedType in value-compatibility checks.
`static byte` `lastEOC(java.nio.ByteBuffer name)`
`protected AbstractCompositeType.ParsedComparator` `parseComparator(int i, java.lang.String part)` Used by fromString
`protected boolean` `readIsStatic(java.nio.ByteBuffer bb)`
`java.nio.ByteBuffer[]` `split(java.nio.ByteBuffer name)` Split a composite column names into it's components.
`static java.util.List<java.nio.ByteBuffer>` `splitName(java.nio.ByteBuffer name)`
`java.lang.String` `toString()` This must be overriden by subclasses if necessary so that for any AbstractType, this == TypeParser.parse(toString()).
`protected AbstractType<?>` `validateComparator(int i, java.nio.ByteBuffer bb)` Like getComparator, but validates that @param i does not exceed the defined range

### Methods inherited from class org.apache.cassandra.db.marshal.AbstractCompositeType

`compareCustom, escape, fromJSONObject, fromString, getSerializer, getString, referencesUserType, toJSONString, validate`

### Methods inherited from class org.apache.cassandra.db.marshal.AbstractType

`asCQL3Type, asCQLTypeStringList, checkComparable, compare, compareCollectionMembers, compareForCQL, compose, decompose, equals, freeze, freezeNestedMulticellTypes, getString, isCollection, isCounter, isEmptyValueMeaningless, isFreezable, isFrozenCollection, isMultiCell, isReversed, isTuple, isUDT, isValueCompatibleWith, parseDefaultParameters, readValue, readValue, referencesDuration, skipValue, testAssignment, toString, validateCellValue, validateCollectionMember, valueLengthIfFixed, writeValue, writtenLength`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Methods inherited from interface java.util.Comparator

`comparing, comparing, comparingDouble, comparingInt, comparingLong, equals, naturalOrder, nullsFirst, nullsLast, reversed, reverseOrder, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong`

### Field Detail

#### STATIC_MARKER

    public static final int STATIC_MARKER

See Also:
  Constant Field Values

#### types

    public final java.util.List<AbstractType<?>> types

### Constructor Detail

#### CompositeType

    protected CompositeType(java.util.List<AbstractType<?>> types)

### Method Detail

#### getInstance

    public static CompositeType getInstance(TypeParser parser)
                                     throws ConfigurationException,
                                            SyntaxException

Throws:
  `ConfigurationException`
  `SyntaxException`

#### getInstance

    public static CompositeType getInstance(AbstractType... types)

#### readIsStatic

    protected boolean readIsStatic(java.nio.ByteBuffer bb)

Specified by:
  `readIsStatic` in class `AbstractCompositeType`

#### getInstance

    public static CompositeType getInstance(java.util.List<AbstractType<?>> types)

#### getComparator

    protected AbstractType<?> getComparator(int i,
                                            java.nio.ByteBuffer bb)

Specified by:
  `getComparator` in class `AbstractCompositeType`
Parameters:
  `i` - DynamicCompositeType will read the type information from @param bb
  `bb` - name of type definition
Returns:
  the comparator for the given component. static CompositeType will consult

#### getComparator

    protected AbstractType<?> getComparator(int i,
                                            java.nio.ByteBuffer bb1,
                                            java.nio.ByteBuffer bb2)

Description copied from class: `AbstractCompositeType`
Adds DynamicCompositeType type information from @param bb1 to @param bb2.

Specified by:
  `getComparator` in class `AbstractCompositeType`
Parameters:
  `i` - is ignored.

#### getAndAppendComparator

    protected AbstractType<?> getAndAppendComparator(int i,
                                                     java.nio.ByteBuffer bb,
                                                     java.lang.StringBuilder sb)

Description copied from class: `AbstractCompositeType`
Adds type information from @param bb to @param sb. @param i is ignored.

Specified by:
  `getAndAppendComparator` in class `AbstractCompositeType`

#### parseComparator

    protected AbstractCompositeType.ParsedComparator parseComparator(int i,
                                                                     java.lang.String part)

Description copied from class: `AbstractCompositeType`
Used by fromString

Specified by:
  `parseComparator` in class `AbstractCompositeType`

#### validateComparator

    protected AbstractType<?> validateComparator(int i,
                                                 java.nio.ByteBuffer bb)
                                          throws MarshalException

Description copied from class: `AbstractCompositeType`
Like getComparator, but validates that @param i does not exceed the defined range

Specified by:
  `validateComparator` in class `AbstractCompositeType`
Throws:
  `MarshalException`

#### decompose

    public java.nio.ByteBuffer decompose(java.lang.Object... objects)

Specified by:
  `decompose` in class `AbstractCompositeType`

#### split

    public java.nio.ByteBuffer[] split(java.nio.ByteBuffer name)

Description copied from class: `AbstractCompositeType`
Split a composite column names into it's components.

Overrides:
  `split` in class `AbstractCompositeType`

#### splitName

    public static java.util.List<java.nio.ByteBuffer> splitName(java.nio.ByteBuffer name)

#### lastEOC

    public static byte lastEOC(java.nio.ByteBuffer name)

#### extractComponent

    public static java.nio.ByteBuffer extractComponent(java.nio.ByteBuffer bb,
                                                       int idx)

#### extractLastComponent

    public java.nio.ByteBuffer extractLastComponent(java.nio.ByteBuffer bb)

#### isStaticName

    public static boolean isStaticName(java.nio.ByteBuffer bb)

#### componentsCount

    public int componentsCount()

Description copied from class: `AbstractType`
The number of subcomponents this type has. This is always 1, i.e. the type has only itself as "subcomponents", except for CompositeType.

Overrides:
  `componentsCount` in class `AbstractType<java.nio.ByteBuffer>`

#### getComponents

    public java.util.List<AbstractType<?>> getComponents()

Description copied from class: `AbstractType`
Return a list of the "subcomponents" this type has. This always return a singleton list with the type itself except for CompositeType.

Overrides:
  `getComponents` in class `AbstractType<java.nio.ByteBuffer>`

#### isCompatibleWith

    public boolean isCompatibleWith(AbstractType<?> previous)

Description copied from class: `AbstractType`
Returns true if this comparator is compatible with the provided previous comparator, that is if previous can safely be replaced by this. A comparator cn should be compatible with a previous one cp if forall columns c1 and c2, if cn.validate(c1) and cn.validate(c2) and cn.compare(c1, c2) == v, then cp.validate(c1) and cp.validate(c2) and cp.compare(c1, c2) == v. Note that a type should be compatible with at least itself and when in doubt, keep the default behavior of not being compatible with any other comparator!

Overrides:
  `isCompatibleWith` in class `AbstractType<java.nio.ByteBuffer>`

#### isValueCompatibleWithInternal

    public boolean isValueCompatibleWithInternal(AbstractType<?> otherType)

Description copied from class: `AbstractType`
Needed to handle ReversedType in value-compatibility checks. Subclasses should implement this instead of isValueCompatibleWith().

Overrides:
  `isValueCompatibleWithInternal` in class `AbstractType<java.nio.ByteBuffer>`

#### 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<java.nio.ByteBuffer>`

#### builder

    public CompositeType.Builder builder()

#### build

    public static java.nio.ByteBuffer build(java.nio.ByteBuffer... buffers)

#### build

    public static java.nio.ByteBuffer build(boolean isStatic,
                                            java.nio.ByteBuffer... buffers)