org.apache.cassandra.db.marshal

## Class ListType<T>

- java.lang.Object
- - org.apache.cassandra.db.marshal.AbstractType<T>
  - - org.apache.cassandra.db.marshal.CollectionType<java.util.List<T>>
    - - org.apache.cassandra.db.marshal.ListType<T>

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

      public class ListType<T>
      extends CollectionType<java.util.List<T>>

- - ### Nested Class Summary

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

      `CollectionType.Kind`

    - ### 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
    Modifier and Type | Field and Description
    --- | ---
    `ListSerializer<T>` | `serializer`

    - ### Fields inherited from class org.apache.cassandra.db.marshal.CollectionType

      `cellPathSerializer, kind`

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

      `comparisonType, isByteOrderComparable, reverseComparator`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `compareCustom(java.nio.ByteBuffer o1, java.nio.ByteBuffer o2)` Implement IFF ComparisonType is CUSTOM Compares the ByteBuffer representation of two instances of this class, for types where this cannot be done by simple in-order comparison of the unsigned bytes Standard Java compare semantics
    `AbstractType<?>` | `freeze()`
    `AbstractType<?>` | `freezeNestedMulticellTypes()` Returns an AbstractType instance that is equivalent to this one, but with all nested UDTs and collections explicitly frozen.
    `Term` | `fromJSONObject(java.lang.Object parsed)` Given a parsed JSON string, return a byte representation of the object.
    `AbstractType<T>` | `getElementsType()`
    `static <T> ListType<T>` | `getInstance(AbstractType<T> elements, boolean isMultiCell)`
    `static ListType<?>` | `getInstance(TypeParser parser)`
    `ListSerializer<T>` | `getSerializer()`
    `boolean` | `isCompatibleWithFrozen(CollectionType<?> previous)` A version of isCompatibleWith() to deal with non-multicell (frozen) collections
    `boolean` | `isMultiCell()`
    `boolean` | `isValueCompatibleWithFrozen(CollectionType<?> previous)` A version of isValueCompatibleWith() to deal with non-multicell (frozen) collections
    `AbstractType<java.util.UUID>` | `nameComparator()`
    `boolean` | `referencesDuration()`
    `boolean` | `referencesUserType(java.lang.String userTypeName)`
    `java.util.List<java.nio.ByteBuffer>` | `serializedValues(java.util.Iterator<Cell> cells)`
    `static java.lang.String` | `setOrListToJsonString(java.nio.ByteBuffer buffer, AbstractType elementsType, ProtocolVersion protocolVersion)`
    `java.lang.String` | `toJSONString(java.nio.ByteBuffer buffer, ProtocolVersion protocolVersion)` Converts the specified value into its JSON representation.
    `java.lang.String` | `toString(boolean ignoreFreezing)`
    `AbstractType<T>` | `valueComparator()`

    - ### Methods inherited from class org.apache.cassandra.db.marshal.CollectionType

      `asCQL3Type, collectionSize, equals, fromString, getString, isCollection, isCompatibleWith, isFreezable, isMap, isValueCompatibleWithInternal, makeCollectionReceiver, serializeForNativeProtocol, toString, validateCellValue`

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

      `asCQLTypeStringList, checkComparable, compare, compareCollectionMembers, compareForCQL, componentsCount, compose, decompose, getComponents, getString, isCounter, isEmptyValueMeaningless, isFrozenCollection, isReversed, isTuple, isUDT, isValueCompatibleWith, parseDefaultParameters, readValue, readValue, skipValue, testAssignment, validate, 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

    - #### serializer

          public final ListSerializer<T> serializer

  - ### Method Detail

    - #### getInstance

          public static ListType<?> getInstance(TypeParser parser)
                                         throws ConfigurationException,
                                                SyntaxException

      Throws:
        `ConfigurationException`
        `SyntaxException`

    - #### getInstance

          public static <T> ListType<T> getInstance(AbstractType<T> elements,
                                                    boolean isMultiCell)

    - #### referencesUserType

          public boolean referencesUserType(java.lang.String userTypeName)

      Overrides:
        `referencesUserType` in class `AbstractType<java.util.List<T>>`

    - #### referencesDuration

          public boolean referencesDuration()

      Overrides:
        `referencesDuration` in class `AbstractType<java.util.List<T>>`

    - #### getElementsType

          public AbstractType<T> getElementsType()

    - #### nameComparator

          public AbstractType<java.util.UUID> nameComparator()

      Specified by:
        `nameComparator` in class `CollectionType<java.util.List<T>>`

    - #### valueComparator

          public AbstractType<T> valueComparator()

      Specified by:
        `valueComparator` in class `CollectionType<java.util.List<T>>`

    - #### getSerializer

          public ListSerializer<T> getSerializer()

      Specified by:
        `getSerializer` in class `CollectionType<java.util.List<T>>`

    - #### freeze

          public AbstractType<?> freeze()

      Overrides:
        `freeze` in class `AbstractType<java.util.List<T>>`

    - #### freezeNestedMulticellTypes

          public AbstractType<?> freezeNestedMulticellTypes()

      Description copied from class: `AbstractType`
      Returns an AbstractType instance that is equivalent to this one, but with all nested UDTs and collections explicitly frozen. This is only necessary for `2.x -> 3.x` schema migrations, and can be removed in Cassandra 4.0. See CASSANDRA-11609 and CASSANDRA-11613.
      Overrides:
        `freezeNestedMulticellTypes` in class `AbstractType<java.util.List<T>>`

    - #### isMultiCell

          public boolean isMultiCell()

      Overrides:
        `isMultiCell` in class `AbstractType<java.util.List<T>>`

    - #### isCompatibleWithFrozen

          public boolean isCompatibleWithFrozen(CollectionType<?> previous)

      Description copied from class: `CollectionType`
      A version of isCompatibleWith() to deal with non-multicell (frozen) collections
      Specified by:
        `isCompatibleWithFrozen` in class `CollectionType<java.util.List<T>>`

    - #### isValueCompatibleWithFrozen

          public boolean isValueCompatibleWithFrozen(CollectionType<?> previous)

      Description copied from class: `CollectionType`
      A version of isValueCompatibleWith() to deal with non-multicell (frozen) collections
      Specified by:
        `isValueCompatibleWithFrozen` in class `CollectionType<java.util.List<T>>`

    - #### compareCustom

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

      Description copied from class: `AbstractType`
      Implement IFF ComparisonType is CUSTOM Compares the ByteBuffer representation of two instances of this class, for types where this cannot be done by simple in-order comparison of the unsigned bytes Standard Java compare semantics
      Overrides:
        `compareCustom` in class `AbstractType<java.util.List<T>>`

    - #### toString

          public java.lang.String toString(boolean ignoreFreezing)

      Overrides:
        `toString` in class `AbstractType<java.util.List<T>>`
      Parameters:
        `ignoreFreezing` - if true, the type string will not be wrapped with FrozenType(...), even if this type is frozen.

    - #### serializedValues

          public java.util.List<java.nio.ByteBuffer> serializedValues(java.util.Iterator<Cell> cells)

      Specified by:
        `serializedValues` in class `CollectionType<java.util.List<T>>`

    - #### fromJSONObject

          public Term fromJSONObject(java.lang.Object parsed)
                              throws MarshalException

      Description copied from class: `AbstractType`
      Given a parsed JSON string, return a byte representation of the object.
      Specified by:
        `fromJSONObject` in class `AbstractType<java.util.List<T>>`
      Parameters:
        `parsed` - the result of parsing a json string
      Throws:
        `MarshalException`

    - #### setOrListToJsonString

          public static java.lang.String setOrListToJsonString(java.nio.ByteBuffer buffer,
                                                               AbstractType elementsType,
                                                               ProtocolVersion protocolVersion)

    - #### toJSONString

          public java.lang.String toJSONString(java.nio.ByteBuffer buffer,
                                               ProtocolVersion protocolVersion)

      Description copied from class: `AbstractType`
      Converts the specified value into its JSON representation.

      The buffer position will stay the same.

      Overrides:
        `toJSONString` in class `AbstractType<java.util.List<T>>`
      Parameters:
        `buffer` - the value to convert
        `protocolVersion` - the protocol version to use for the conversion
      Returns:
        a JSON string representing the specified value

Copyright © 2018 The Apache Software Foundation