public class UserType extends TupleType implements SchemaElement
AbstractType.ComparisonType
SchemaElement.SchemaElementType
AssignmentTestable.TestResult
Modifier and Type | Field and Description |
---|---|
java.lang.String |
keyspace |
java.nio.ByteBuffer |
name |
comparatorSet, comparisonType, isByteOrderComparable, reverseComparator
NAME_COMPARATOR
Constructor and Description |
---|
UserType(java.lang.String keyspace,
java.nio.ByteBuffer name,
java.util.List<FieldIdentifier> fieldNames,
java.util.List<AbstractType<?>> fieldTypes,
boolean isMultiCell) |
Modifier and Type | Method and Description |
---|---|
CQL3Type |
asCQL3Type() |
CellPath |
cellPathForField(FieldIdentifier fieldName) |
java.util.Optional<Difference> |
compare(UserType other) |
java.lang.String |
elementKeyspace()
Returns the CQL name of the keyspace to which this schema element belong.
|
java.lang.String |
elementName()
Returns the CQL name of this schema element.
|
SchemaElement.SchemaElementType |
elementType()
Return the schema element type
|
boolean |
equals(java.lang.Object o) |
FieldIdentifier |
fieldName(int i) |
java.lang.String |
fieldNameAsString(int i) |
java.util.List<FieldIdentifier> |
fieldNames() |
int |
fieldPosition(FieldIdentifier fieldName) |
AbstractType<?> |
fieldType(int i) |
java.util.List<AbstractType<?>> |
fieldTypes() |
UserType |
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.
|
java.lang.String |
getCqlTypeName() |
static UserType |
getInstance(TypeParser parser) |
java.lang.String |
getNameAsString() |
TypeSerializer<java.nio.ByteBuffer> |
getSerializer() |
int |
hashCode() |
boolean |
isFreezable() |
boolean |
isMultiCell() |
boolean |
isTuple() |
boolean |
isUDT() |
boolean |
isValueCompatibleWith(AbstractType<?> previous)
Returns true if values of the other AbstractType can be read and "reasonably" interpreted by the this
AbstractType.
|
ShortType |
nameComparator() |
boolean |
referencesDuration() |
<V> boolean |
referencesUserType(V name,
ValueAccessor<V> accessor) |
java.nio.ByteBuffer |
serializeForNativeProtocol(java.util.Iterator<Cell<?>> cells,
ProtocolVersion protocolVersion) |
java.lang.String |
toCqlString(boolean withInternals,
boolean ifNotExists)
Returns a CQL representation of this element
|
java.lang.String |
toJSONString(java.nio.ByteBuffer buffer,
ProtocolVersion protocolVersion)
Converts the specified value into its JSON representation.
|
java.lang.String |
toString()
This must be overriden by subclasses if necessary so that for any
AbstractType, this == TypeParser.parse(toString()).
|
java.lang.String |
toString(boolean ignoreFreezing) |
<V> void |
validateCell(Cell<V> cell) |
UserType |
withUpdatedUserType(UserType udt)
Returns an instance of this type with all references to the provided user type recursively replaced with its new
definition.
|
allTypes, buildValue, buildValue, compareCustom, expandUserTypes, fromString, getString, isCompatibleWith, isValueCompatibleWithInternal, size, split, subTypes, type
asCQLTypeStringList, checkComparable, compare, compare, compareCollectionMembers, compareForCQL, compose, compose, decompose, getComponents, getString, getString, isCollection, isCounter, isEmptyValueMeaningless, isFrozenCollection, isReversed, parseDefaultParameters, read, readArray, readBuffer, readBuffer, referencesUserType, skipValue, testAssignment, testAssignment, toJSONString, validate, validate, validateCellValue, validateCollectionMember, valueLengthIfFixed, writeValue, writeValue, writtenLength, writtenLength
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
elementKeyspaceQuotedIfNeeded, elementNameQuotedIfNeeded
public final java.lang.String keyspace
public final java.nio.ByteBuffer name
public UserType(java.lang.String keyspace, java.nio.ByteBuffer name, java.util.List<FieldIdentifier> fieldNames, java.util.List<AbstractType<?>> fieldTypes, boolean isMultiCell)
public static UserType getInstance(TypeParser parser)
public boolean isUDT()
isUDT
in class AbstractType<java.nio.ByteBuffer>
public boolean isMultiCell()
isMultiCell
in class AbstractType<java.nio.ByteBuffer>
public boolean isFreezable()
isFreezable
in class AbstractType<java.nio.ByteBuffer>
public AbstractType<?> fieldType(int i)
public java.util.List<AbstractType<?>> fieldTypes()
public FieldIdentifier fieldName(int i)
public java.lang.String fieldNameAsString(int i)
public java.util.List<FieldIdentifier> fieldNames()
public java.lang.String getNameAsString()
public int fieldPosition(FieldIdentifier fieldName)
public CellPath cellPathForField(FieldIdentifier fieldName)
public ShortType nameComparator()
public java.nio.ByteBuffer serializeForNativeProtocol(java.util.Iterator<Cell<?>> cells, ProtocolVersion protocolVersion)
public <V> void validateCell(Cell<V> cell) throws MarshalException
MarshalException
public Term fromJSONObject(java.lang.Object parsed) throws MarshalException
AbstractType
fromJSONObject
in class TupleType
parsed
- the result of parsing a json stringMarshalException
public java.lang.String toJSONString(java.nio.ByteBuffer buffer, ProtocolVersion protocolVersion)
AbstractType
The buffer position will stay the same.
toJSONString
in class TupleType
buffer
- the value to convertprotocolVersion
- the protocol version to use for the conversionpublic UserType freeze()
freeze
in class AbstractType<java.nio.ByteBuffer>
public AbstractType<?> freezeNestedMulticellTypes()
AbstractType
2.x -> 3.x
schema migrations, and can be removed in Cassandra 4.0.
See CASSANDRA-11609 and CASSANDRA-11613.freezeNestedMulticellTypes
in class AbstractType<java.nio.ByteBuffer>
public boolean isValueCompatibleWith(AbstractType<?> previous)
AbstractType
isValueCompatibleWith
in class AbstractType<java.nio.ByteBuffer>
public boolean equals(java.lang.Object o)
public java.util.Optional<Difference> compare(UserType other)
public CQL3Type asCQL3Type()
asCQL3Type
in class TupleType
public <V> boolean referencesUserType(V name, ValueAccessor<V> accessor)
referencesUserType
in class TupleType
public UserType withUpdatedUserType(UserType udt)
AbstractType
withUpdatedUserType
in class TupleType
public boolean referencesDuration()
referencesDuration
in class TupleType
public java.lang.String toString()
AbstractType
public java.lang.String toString(boolean ignoreFreezing)
toString
in class AbstractType<java.nio.ByteBuffer>
ignoreFreezing
- if true, the type string will not be wrapped with FrozenType(...), even if this type is frozen.public java.lang.String getCqlTypeName()
public TypeSerializer<java.nio.ByteBuffer> getSerializer()
getSerializer
in class TupleType
public SchemaElement.SchemaElementType elementType()
SchemaElement
elementType
in interface SchemaElement
public java.lang.String elementKeyspace()
SchemaElement
elementKeyspace
in interface SchemaElement
public java.lang.String elementName()
SchemaElement
elementName
in interface SchemaElement
public java.lang.String toCqlString(boolean withInternals, boolean ifNotExists)
SchemaElement
toCqlString
in interface SchemaElement
withInternals
- if the internals part of the CQL should be exposed.ifNotExists
- if "IF NOT EXISTS" should be included.Copyright © 2009-2022 The Apache Software Foundation