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 class
UserType.Field
A 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.String
asFunctionParameterString()
Returns a String representation of this data type suitable for inclusion as a parameter type in a function or aggregate signature.boolean
contains(java.lang.String name)
Returns whether this UDT contains a given field.UserType
copy(boolean newFrozen)
boolean
equals(java.lang.Object o)
java.lang.String
getKeyspace()
The name of the keyspace this UDT is part of.java.lang.String
getTypeName()
The name of this user type.int
hashCode()
boolean
isFrozen()
Returns whether this data type is frozen.java.util.Iterator<UserType.Field>
iterator()
Returns an iterator over the fields of this UDT.UDTValue
newValue()
Returns a new empty value for this user type definition.int
size()
Returns the number of fields in this UDT.java.lang.String
toString()
-
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 thatname
obey 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:
true
if this UDT contains a field namedname
,false
otherwise.
-
iterator
public java.util.Iterator<UserType.Field> iterator()
Returns an iterator over the fields of this UDT.- Specified by:
iterator
in interfacejava.lang.Iterable<UserType.Field>
- Returns:
- an iterator over the fields of this UDT.
-
isFrozen
public boolean isFrozen()
Description copied from class:DataType
Returns 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:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
asFunctionParameterString
public java.lang.String asFunctionParameterString()
Description copied from class:DataType
Returns 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. thefrozen
keyword is not accepted.- Overrides:
asFunctionParameterString
in classDataType
- Returns:
- a String representation of this data type suitable for inclusion as a parameter type in a function or aggregate signature.
-
-