Package 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 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
comparatorSet, comparisonType, isByteOrderComparable, reverseComparator
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description <VL,VR>
intcompareCustom(VL left, ValueAccessor<VL> accessorL, VR right, ValueAccessor<VR> accessorR)Implement IFF ComparisonType is CUSTOM Compares the byte 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 semanticsAbstractType<?>expandUserTypes()Replace any instances of UserType with equivalent TupleType-s.AbstractType<?>freeze()AbstractType<?>freezeNestedMulticellTypes()Returns an AbstractType instance that is equivalent to this one, but with all nested UDTs and collections explicitly frozen.TermfromJSONObject(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()java.nio.ByteBuffergetSliceFromSerialized(java.nio.ByteBuffer collection, java.nio.ByteBuffer from, java.nio.ByteBuffer to)booleanisCompatibleWithFrozen(CollectionType<?> previous)A version of isCompatibleWith() to deal with non-multicell (frozen) collectionsbooleanisMultiCell()booleanisValueCompatibleWithFrozen(CollectionType<?> previous)A version of isValueCompatibleWith() to deal with non-multicell (frozen) collectionsAbstractType<TimeUUID>nameComparator()booleanreferencesDuration()<V> booleanreferencesUserType(V name, ValueAccessor<V> accessor)java.util.List<java.nio.ByteBuffer>serializedValues(java.util.Iterator<Cell<?>> cells)static java.lang.StringsetOrListToJsonString(java.nio.ByteBuffer buffer, AbstractType elementsType, ProtocolVersion protocolVersion)java.util.List<AbstractType<?>>subTypes()java.lang.StringtoJSONString(java.nio.ByteBuffer buffer, ProtocolVersion protocolVersion)Converts the specified value into its JSON representation.java.lang.StringtoString(boolean ignoreFreezing)AbstractType<T>valueComparator()ListType<?>withUpdatedUserType(UserType udt)Returns an instance of this type with all references to the provided user type recursively replaced with its new definition.-
Methods inherited from class org.apache.cassandra.db.marshal.CollectionType
asCQL3Type, collectionSize, equals, fromString, getString, isCollection, isCompatibleWith, isFreezable, isMap, isSerializationCompatibleWith, isValueCompatibleWithInternal, makeCollectionReceiver, serializeForNativeProtocol, toString, validateCellValue
-
Methods inherited from class org.apache.cassandra.db.marshal.AbstractType
asCQLTypeStringList, checkComparable, compare, compare, compareCollectionMembers, compareForCQL, compose, compose, decompose, decomposeUntyped, getComponents, getString, getString, isCounter, isEmptyValueMeaningless, isFrozenCollection, isReversed, isTuple, isUDT, isValueCompatibleWith, parseDefaultParameters, read, readArray, readBuffer, readBuffer, referencesUserType, skipValue, testAssignment, testAssignment, toCQLString, toJSONString, udfType, unwrap, validate, validate, validateCollectionMember, valueLengthIfFixed, writeValue, writeValue, writtenLength, writtenLength
-
-
-
-
Field Detail
-
serializer
public final ListSerializer<T> serializer
-
-
Method Detail
-
getInstance
public static ListType<?> getInstance(TypeParser parser) throws ConfigurationException, SyntaxException
-
getInstance
public static <T> ListType<T> getInstance(AbstractType<T> elements, boolean isMultiCell)
-
referencesUserType
public <V> boolean referencesUserType(V name, ValueAccessor<V> accessor)- Overrides:
referencesUserTypein classAbstractType<java.util.List<T>>
-
withUpdatedUserType
public ListType<?> withUpdatedUserType(UserType udt)
Description copied from class:AbstractTypeReturns an instance of this type with all references to the provided user type recursively replaced with its new definition.- Overrides:
withUpdatedUserTypein classAbstractType<java.util.List<T>>
-
expandUserTypes
public AbstractType<?> expandUserTypes()
Description copied from class:AbstractTypeReplace any instances of UserType with equivalent TupleType-s. We need it for dropped_columns, to allow safely dropping unused user types later without retaining any references to them in system_schema.dropped_columns.- Overrides:
expandUserTypesin classAbstractType<java.util.List<T>>
-
referencesDuration
public boolean referencesDuration()
- Overrides:
referencesDurationin classAbstractType<java.util.List<T>>
-
getElementsType
public AbstractType<T> getElementsType()
-
nameComparator
public AbstractType<TimeUUID> nameComparator()
- Specified by:
nameComparatorin classCollectionType<java.util.List<T>>
-
valueComparator
public AbstractType<T> valueComparator()
- Specified by:
valueComparatorin classCollectionType<java.util.List<T>>
-
getSerializer
public ListSerializer<T> getSerializer()
- Specified by:
getSerializerin classCollectionType<java.util.List<T>>
-
freeze
public AbstractType<?> freeze()
- Overrides:
freezein classAbstractType<java.util.List<T>>
-
freezeNestedMulticellTypes
public AbstractType<?> freezeNestedMulticellTypes()
Description copied from class:AbstractTypeReturns an AbstractType instance that is equivalent to this one, but with all nested UDTs and collections explicitly frozen. This is only necessary for2.x -> 3.xschema migrations, and can be removed in Cassandra 4.0. See CASSANDRA-11609 and CASSANDRA-11613.- Overrides:
freezeNestedMulticellTypesin classAbstractType<java.util.List<T>>
-
subTypes
public java.util.List<AbstractType<?>> subTypes()
- Overrides:
subTypesin classAbstractType<java.util.List<T>>
-
isMultiCell
public boolean isMultiCell()
- Overrides:
isMultiCellin classAbstractType<java.util.List<T>>
-
isCompatibleWithFrozen
public boolean isCompatibleWithFrozen(CollectionType<?> previous)
Description copied from class:CollectionTypeA version of isCompatibleWith() to deal with non-multicell (frozen) collections- Specified by:
isCompatibleWithFrozenin classCollectionType<java.util.List<T>>
-
isValueCompatibleWithFrozen
public boolean isValueCompatibleWithFrozen(CollectionType<?> previous)
Description copied from class:CollectionTypeA version of isValueCompatibleWith() to deal with non-multicell (frozen) collections- Specified by:
isValueCompatibleWithFrozenin classCollectionType<java.util.List<T>>
-
compareCustom
public <VL,VR> int compareCustom(VL left, ValueAccessor<VL> accessorL, VR right, ValueAccessor<VR> accessorR)Description copied from class:AbstractTypeImplement IFF ComparisonType is CUSTOM Compares the byte 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:
compareCustomin classAbstractType<java.util.List<T>>
-
toString
public java.lang.String toString(boolean ignoreFreezing)
- Overrides:
toStringin classAbstractType<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:
serializedValuesin classCollectionType<java.util.List<T>>
-
fromJSONObject
public Term fromJSONObject(java.lang.Object parsed) throws MarshalException
Description copied from class:AbstractTypeGiven a parsed JSON string, return a byte representation of the object.- Specified by:
fromJSONObjectin classAbstractType<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)
-
getSliceFromSerialized
public java.nio.ByteBuffer getSliceFromSerialized(java.nio.ByteBuffer collection, java.nio.ByteBuffer from, java.nio.ByteBuffer to)
-
toJSONString
public java.lang.String toJSONString(java.nio.ByteBuffer buffer, ProtocolVersion protocolVersion)Description copied from class:AbstractTypeConverts the specified value into its JSON representation.The buffer position will stay the same.
- Overrides:
toJSONStringin classAbstractType<java.util.List<T>>- Parameters:
buffer- the value to convertprotocolVersion- the protocol version to use for the conversion- Returns:
- a JSON string representing the specified value
-
-