Package org.apache.cassandra.db.marshal
Class DynamicCompositeType
- java.lang.Object
-
- org.apache.cassandra.db.marshal.AbstractType<java.nio.ByteBuffer>
-
- org.apache.cassandra.db.marshal.AbstractCompositeType
-
- org.apache.cassandra.db.marshal.DynamicCompositeType
-
- All Implemented Interfaces:
java.util.Comparator<java.nio.ByteBuffer>,AssignmentTestable
public class DynamicCompositeType extends AbstractCompositeType
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classDynamicCompositeType.FixedValueComparatorstatic classDynamicCompositeType.Serializer-
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 Modifier and Type Field Description java.util.Map<java.lang.Byte,AbstractType<?>>aliases-
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 java.nio.ByteBufferdecompose(java.lang.Object... objects)AbstractType<?>expandUserTypes()Replace any instances of UserType with equivalent TupleType-s.protected <V> AbstractType<?>getAndAppendComparator(int i, V value, ValueAccessor<V> accessor, java.lang.StringBuilder sb, int offset)Adds type information from @param bb to @param sb.protected <VL,VR>
AbstractType<?>getComparator(int i, VL left, ValueAccessor<VL> accessorL, VR right, ValueAccessor<VR> accessorR, int offsetL, int offsetR)Adds DynamicCompositeType type information from @param bb1 to @param bb2.protected <V> AbstractType<?>getComparator(int i, V value, ValueAccessor<V> accessor, int offset)protected <V> intgetComparatorSize(int i, V value, ValueAccessor<V> accessor, int offset)static DynamicCompositeTypegetInstance(java.util.Map<java.lang.Byte,AbstractType<?>> aliases)static DynamicCompositeTypegetInstance(TypeParser parser)TypeSerializer<java.nio.ByteBuffer>getSerializer()booleanisCompatibleWith(AbstractType<?> previous)Returns true if this comparator is compatible with the provided previous comparator, that is if previous can safely be replaced by this.protected AbstractCompositeType.ParsedComparatorparseComparator(int i, java.lang.String part)Used by fromStringprotected <V> booleanreadIsStatic(V value, ValueAccessor<V> accessor)<V> booleanreferencesUserType(V name, ValueAccessor<V> accessor)protected intstartingOffset(boolean isStatic)java.lang.StringtoString()This must be overriden by subclasses if necessary so that for any AbstractType, this == TypeParser.parse(toString()).protected <V> AbstractType<?>validateComparator(int i, V input, ValueAccessor<V> accessor, int offset)Like getComparator, but validates that @param i does not exceed the defined rangeDynamicCompositeTypewithUpdatedUserType(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.AbstractCompositeType
compareCustom, escape, fromJSONObject, fromString, getString, split, toJSONString, validate, validate
-
Methods inherited from class org.apache.cassandra.db.marshal.AbstractType
asCQL3Type, asCQLTypeStringList, checkComparable, compare, compare, compareCollectionMembers, compareForCQL, compose, compose, decompose, decomposeUntyped, freeze, freezeNestedMulticellTypes, getComponents, getString, getString, isCollection, isCounter, isEmptyValueMeaningless, isFreezable, isFrozenCollection, isMultiCell, isReversed, isSerializationCompatibleWith, isTuple, isUDT, isValueCompatibleWith, isValueCompatibleWithInternal, parseDefaultParameters, read, readArray, readBuffer, readBuffer, referencesDuration, referencesUserType, skipValue, subTypes, testAssignment, testAssignment, toCQLString, toJSONString, toString, udfType, unwrap, validateCellValue, validateCollectionMember, valueLengthIfFixed, writeValue, writeValue, writtenLength, writtenLength
-
-
-
-
Field Detail
-
aliases
public final java.util.Map<java.lang.Byte,AbstractType<?>> aliases
-
-
Method Detail
-
getInstance
public static DynamicCompositeType getInstance(TypeParser parser)
-
getInstance
public static DynamicCompositeType getInstance(java.util.Map<java.lang.Byte,AbstractType<?>> aliases)
-
getSerializer
public TypeSerializer<java.nio.ByteBuffer> getSerializer()
- Overrides:
getSerializerin classAbstractCompositeType
-
readIsStatic
protected <V> boolean readIsStatic(V value, ValueAccessor<V> accessor)- Specified by:
readIsStaticin classAbstractCompositeType
-
startingOffset
protected int startingOffset(boolean isStatic)
- Specified by:
startingOffsetin classAbstractCompositeType
-
getComparatorSize
protected <V> int getComparatorSize(int i, V value, ValueAccessor<V> accessor, int offset)- Specified by:
getComparatorSizein classAbstractCompositeType
-
getComparator
protected <V> AbstractType<?> getComparator(int i, V value, ValueAccessor<V> accessor, int offset)
- Specified by:
getComparatorin classAbstractCompositeType- Parameters:
i- DynamicCompositeType will read the type information from @param bbvalue- name of type definition- Returns:
- the comparator for the given component. static CompositeType will consult
-
getComparator
protected <VL,VR> AbstractType<?> getComparator(int i, VL left, ValueAccessor<VL> accessorL, VR right, ValueAccessor<VR> accessorR, int offsetL, int offsetR)
Description copied from class:AbstractCompositeTypeAdds DynamicCompositeType type information from @param bb1 to @param bb2.- Specified by:
getComparatorin classAbstractCompositeType- Parameters:
i- is ignored.
-
getAndAppendComparator
protected <V> AbstractType<?> getAndAppendComparator(int i, V value, ValueAccessor<V> accessor, java.lang.StringBuilder sb, int offset)
Description copied from class:AbstractCompositeTypeAdds type information from @param bb to @param sb. @param i is ignored.- Specified by:
getAndAppendComparatorin classAbstractCompositeType
-
parseComparator
protected AbstractCompositeType.ParsedComparator parseComparator(int i, java.lang.String part)
Description copied from class:AbstractCompositeTypeUsed by fromString- Specified by:
parseComparatorin classAbstractCompositeType
-
validateComparator
protected <V> AbstractType<?> validateComparator(int i, V input, ValueAccessor<V> accessor, int offset) throws MarshalException
Description copied from class:AbstractCompositeTypeLike getComparator, but validates that @param i does not exceed the defined range- Specified by:
validateComparatorin classAbstractCompositeType- Throws:
MarshalException
-
decompose
public java.nio.ByteBuffer decompose(java.lang.Object... objects)
- Specified by:
decomposein classAbstractCompositeType
-
isCompatibleWith
public boolean isCompatibleWith(AbstractType<?> previous)
Description copied from class:AbstractTypeReturns 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:
isCompatibleWithin classAbstractType<java.nio.ByteBuffer>
-
referencesUserType
public <V> boolean referencesUserType(V name, ValueAccessor<V> accessor)- Overrides:
referencesUserTypein classAbstractType<java.nio.ByteBuffer>
-
withUpdatedUserType
public DynamicCompositeType 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.nio.ByteBuffer>
-
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.nio.ByteBuffer>
-
toString
public java.lang.String toString()
Description copied from class:AbstractTypeThis 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:
toStringin classAbstractType<java.nio.ByteBuffer>
-
-