public class UserType extends DataType implements Iterable<UserType.Field>
A UDT is a essentially a named collection of fields (with a name and a type).
Modifier and Type | Class and Description |
---|---|
static class |
UserType.Field
A UDT field.
|
DataType.Name
Modifier and Type | Method and Description |
---|---|
String |
asCQLQuery()
Returns a CQL query representing this user type.
|
boolean |
contains(String name)
Returns whether this UDT contains a given field.
|
boolean |
equals(Object o) |
String |
exportAsString()
Returns a CQL query representing this user type in human readable form.
|
Collection<String> |
getFieldNames()
Returns the names of the fields of this UDT.
|
DataType |
getFieldType(String name)
Returns the type of a given field.
|
String |
getKeyspace()
The name of the keyspace this UDT is part of.
|
String |
getTypeName()
The name of this user type.
|
int |
hashCode() |
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.
|
String |
toString() |
allPrimitiveTypes, ascii, asJavaClass, bigint, blob, cboolean, cdouble, cfloat, cint, counter, custom, decimal, deserialize, format, getCustomTypeClassName, getName, getTypeArguments, inet, isCollection, isFrozen, list, map, parse, serialize, serializeValue, set, text, timestamp, timeuuid, uuid, varchar, varint
public UDTValue newValue()
public String getKeyspace()
public String getTypeName()
public int size()
public boolean contains(String name)
name
- the name to check. Note that name
obey the usual
CQL identifier rules: it should be quoted if it denotes a case sensitive
identifier (you can use Metadata.quote(java.lang.String)
for the quoting).true
if this UDT contains a field named name
,
false
otherwise.public Iterator<UserType.Field> iterator()
iterator
in interface Iterable<UserType.Field>
public Collection<String> getFieldNames()
public DataType getFieldType(String name)
name
- the name of the field. Note that name
obey the usual
CQL identifier rules: it should be quoted if it denotes a case sensitive
identifier (you can use Metadata.quote(java.lang.String)
for the quoting).name
if this UDT has a field of this
name, null
otherwise.IllegalArgumentException
- if name
is not a field of this
UDT definition.public String exportAsString()
This method is equivalent to asCQLQuery()
but the ouptut is
formatted to be human readable (for some definition of human readable).
public String asCQLQuery()
This method returns a single 'CREATE TYPE' query corresponding to this UDT definition.
Note that the returned string is a single line; the returned query is not formatted in any way.
exportAsString()
Copyright © 2014. All rights reserved.