Class 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).

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

        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 java.lang.Object
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.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. 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.