java.lang.Object
org.apache.cassandra.cql3.functions.types.DataType
org.apache.cassandra.cql3.functions.types.UserType
All Implemented Interfaces:
Iterable<UserType.Field>

public class UserType extends DataType implements Iterable<UserType.Field>
A User Defined Type (UDT).

A UDT is a essentially a named collection of fields (with a name and a type).

  • Method Details

    • 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 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 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(String name)
      Returns whether this UDT contains a given field.
      Parameters:
      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).
      Returns:
      true if this UDT contains a field named name, false otherwise.
    • iterator

      public Iterator<UserType.Field> iterator()
      Returns an iterator over the fields of this UDT.
      Specified by:
      iterator in interface 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.

      Specified by:
      isFrozen in class DataType
      Returns:
      whether this data type is frozen.
    • copy

      public UserType copy(boolean newFrozen)
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • asFunctionParameterString

      public 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. the frozen keyword is not accepted.

      Overrides:
      asFunctionParameterString in class DataType
      Returns:
      a String representation of this data type suitable for inclusion as a parameter type in a function or aggregate signature.