Class UserType
- java.lang.Object
-
- org.apache.cassandra.cql3.functions.types.DataType
-
- org.apache.cassandra.cql3.functions.types.UserType
-
- All Implemented Interfaces:
java.lang.Iterable<UserType.Field>
public class UserType extends DataType implements java.lang.Iterable<UserType.Field>
A User Defined Type (UDT).A UDT is a essentially a named collection of fields (with a name and a type).
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classUserType.FieldA UDT field.-
Nested classes/interfaces inherited from class org.apache.cassandra.cql3.functions.types.DataType
DataType.CollectionType, DataType.CustomType, DataType.Name, DataType.NativeType
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringasFunctionParameterString()Returns a String representation of this data type suitable for inclusion as a parameter type in a function or aggregate signature.booleancontains(java.lang.String name)Returns whether this UDT contains a given field.UserTypecopy(boolean newFrozen)booleanequals(java.lang.Object o)java.lang.StringgetKeyspace()The name of the keyspace this UDT is part of.java.lang.StringgetTypeName()The name of this user type.inthashCode()booleanisFrozen()Returns whether this data type is frozen.java.util.Iterator<UserType.Field>iterator()Returns an iterator over the fields of this UDT.UDTValuenewValue()Returns a new empty value for this user type definition.intsize()Returns the number of fields in this UDT.java.lang.StringtoString()-
Methods inherited from class org.apache.cassandra.cql3.functions.types.DataType
ascii, bigint, blob, cboolean, cdouble, cfloat, cint, counter, custom, date, decimal, duration, getName, getTypeArguments, inet, isCollection, list, list, map, map, set, set, smallint, text, time, timestamp, timeuuid, tinyint, uuid, varchar, varint
-
-
-
-
Method Detail
-
newValue
public UDTValue newValue()
Returns a new empty value for this user type definition.- Returns:
- an empty value for this user type definition.
-
getKeyspace
public java.lang.String getKeyspace()
The name of the keyspace this UDT is part of.- Returns:
- the name of the keyspace this UDT is part of.
-
getTypeName
public java.lang.String getTypeName()
The name of this user type.- Returns:
- the name of this user type.
-
size
public int size()
Returns the number of fields in this UDT.- Returns:
- the number of fields in this UDT.
-
contains
public boolean contains(java.lang.String name)
Returns whether this UDT contains a given field.- Parameters:
name- the name to check. Note thatnameobey the usual CQL identifier rules: it should be quoted if it denotes a case sensitive identifier (you can useMetadata.quote(java.lang.String)for the quoting).- Returns:
trueif this UDT contains a field namedname,falseotherwise.
-
iterator
public java.util.Iterator<UserType.Field> iterator()
Returns an iterator over the fields of this UDT.- Specified by:
iteratorin interfacejava.lang.Iterable<UserType.Field>- Returns:
- an iterator over the fields of this UDT.
-
isFrozen
public boolean isFrozen()
Description copied from class:DataTypeReturns whether this data type is frozen.This applies to User Defined Types, tuples and nested collections. Frozen types are serialized as a single value in Cassandra's storage engine, whereas non-frozen types are stored in a form that allows updates to individual subfields.
-
copy
public UserType copy(boolean newFrozen)
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
asFunctionParameterString
public java.lang.String asFunctionParameterString()
Description copied from class:DataTypeReturns a String representation of this data type suitable for inclusion as a parameter type in a function or aggregate signature.In such places, the String representation might vary from the canonical one as returned by
Object.toString(); e.g. thefrozenkeyword is not accepted.- Overrides:
asFunctionParameterStringin classDataType- Returns:
- a String representation of this data type suitable for inclusion as a parameter type in a function or aggregate signature.
-
-