Package org.apache.cassandra.db.marshal
Class MapType<K,V>
- java.lang.Object
-
- org.apache.cassandra.db.marshal.AbstractType<T>
-
- org.apache.cassandra.db.marshal.CollectionType<java.util.Map<K,V>>
-
- org.apache.cassandra.db.marshal.MapType<K,V>
-
- All Implemented Interfaces:
java.util.Comparator<java.nio.ByteBuffer>
,AssignmentTestable
public class MapType<K,V> extends CollectionType<java.util.Map<K,V>>
-
-
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 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 protected int
collectionSize(java.util.List<java.nio.ByteBuffer> values)
<RL,TR>
intcompareCustom(RL left, ValueAccessor<RL> accessorL, TR right, ValueAccessor<TR> 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 semanticsstatic <TL,TR>
intcompareMaps(AbstractType<?> keysComparator, AbstractType<?> valuesComparator, TL left, ValueAccessor<TL> accessorL, TR right, ValueAccessor<TR> accessorR)
AbstractType<?>
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.Term
fromJSONObject(java.lang.Object parsed)
Given a parsed JSON string, return a byte representation of the object.static <K,V>
MapType<K,V>getInstance(AbstractType<K> keys, AbstractType<V> values, boolean isMultiCell)
static MapType<?,?>
getInstance(TypeParser parser)
AbstractType<K>
getKeysType()
MapSerializer<K,V>
getSerializer()
AbstractType<V>
getValuesType()
boolean
isCompatibleWithFrozen(CollectionType<?> previous)
A version of isCompatibleWith() to deal with non-multicell (frozen) collectionsboolean
isMultiCell()
boolean
isValueCompatibleWithFrozen(CollectionType<?> previous)
A version of isValueCompatibleWith() to deal with non-multicell (frozen) collectionsAbstractType<K>
nameComparator()
boolean
referencesDuration()
<T> boolean
referencesUserType(T name, ValueAccessor<T> accessor)
java.util.List<java.nio.ByteBuffer>
serializedValues(java.util.Iterator<Cell<?>> cells)
java.util.List<AbstractType<?>>
subTypes()
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<V>
valueComparator()
MapType<?,?>
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, 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, compare, compareCollectionMembers, compareForCQL, compose, compose, decompose, getComponents, getString, getString, isCounter, isEmptyValueMeaningless, isFrozenCollection, isReversed, isTuple, isUDT, isValueCompatibleWith, parseDefaultParameters, read, readArray, readBuffer, readBuffer, referencesUserType, skipValue, testAssignment, testAssignment, toJSONString, validate, validate, validateCollectionMember, valueLengthIfFixed, writeValue, writeValue, writtenLength, writtenLength
-
-
-
-
Method Detail
-
getInstance
public static MapType<?,?> getInstance(TypeParser parser) throws ConfigurationException, SyntaxException
-
getInstance
public static <K,V> MapType<K,V> getInstance(AbstractType<K> keys, AbstractType<V> values, boolean isMultiCell)
-
referencesUserType
public <T> boolean referencesUserType(T name, ValueAccessor<T> accessor)
- Overrides:
referencesUserType
in classAbstractType<java.util.Map<K,V>>
-
withUpdatedUserType
public MapType<?,?> withUpdatedUserType(UserType udt)
Description copied from class:AbstractType
Returns an instance of this type with all references to the provided user type recursively replaced with its new definition.- Overrides:
withUpdatedUserType
in classAbstractType<java.util.Map<K,V>>
-
expandUserTypes
public AbstractType<?> expandUserTypes()
Description copied from class:AbstractType
Replace 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:
expandUserTypes
in classAbstractType<java.util.Map<K,V>>
-
referencesDuration
public boolean referencesDuration()
- Overrides:
referencesDuration
in classAbstractType<java.util.Map<K,V>>
-
getKeysType
public AbstractType<K> getKeysType()
-
getValuesType
public AbstractType<V> getValuesType()
-
nameComparator
public AbstractType<K> nameComparator()
- Specified by:
nameComparator
in classCollectionType<java.util.Map<K,V>>
-
valueComparator
public AbstractType<V> valueComparator()
- Specified by:
valueComparator
in classCollectionType<java.util.Map<K,V>>
-
isMultiCell
public boolean isMultiCell()
- Overrides:
isMultiCell
in classAbstractType<java.util.Map<K,V>>
-
subTypes
public java.util.List<AbstractType<?>> subTypes()
- Overrides:
subTypes
in classAbstractType<java.util.Map<K,V>>
-
freeze
public AbstractType<?> freeze()
- Overrides:
freeze
in classAbstractType<java.util.Map<K,V>>
-
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 for2.x -> 3.x
schema migrations, and can be removed in Cassandra 4.0. See CASSANDRA-11609 and CASSANDRA-11613.- Overrides:
freezeNestedMulticellTypes
in classAbstractType<java.util.Map<K,V>>
-
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 classCollectionType<java.util.Map<K,V>>
-
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 classCollectionType<java.util.Map<K,V>>
-
compareCustom
public <RL,TR> int compareCustom(RL left, ValueAccessor<RL> accessorL, TR right, ValueAccessor<TR> accessorR)
Description copied from class:AbstractType
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 semantics- Overrides:
compareCustom
in classAbstractType<java.util.Map<K,V>>
-
compareMaps
public static <TL,TR> int compareMaps(AbstractType<?> keysComparator, AbstractType<?> valuesComparator, TL left, ValueAccessor<TL> accessorL, TR right, ValueAccessor<TR> accessorR)
-
getSerializer
public MapSerializer<K,V> getSerializer()
- Specified by:
getSerializer
in classCollectionType<java.util.Map<K,V>>
-
collectionSize
protected int collectionSize(java.util.List<java.nio.ByteBuffer> values)
- Overrides:
collectionSize
in classCollectionType<java.util.Map<K,V>>
-
toString
public java.lang.String toString(boolean ignoreFreezing)
- Overrides:
toString
in classAbstractType<java.util.Map<K,V>>
- 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 classCollectionType<java.util.Map<K,V>>
-
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 classAbstractType<java.util.Map<K,V>>
- Parameters:
parsed
- the result of parsing a json string- Throws:
MarshalException
-
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 classAbstractType<java.util.Map<K,V>>
- Parameters:
buffer
- the value to convertprotocolVersion
- the protocol version to use for the conversion- Returns:
- a JSON string representing the specified value
-
-