Class DataType

    • Method Detail

      • ascii

        public static DataType ascii()
        Returns the ASCII type.
        Returns:
        The ASCII type.
      • bigint

        public static DataType bigint()
        Returns the BIGINT type.
        Returns:
        The BIGINT type.
      • blob

        public static DataType blob()
        Returns the BLOB type.
        Returns:
        The BLOB type.
      • cboolean

        public static DataType cboolean()
        Returns the BOOLEAN type.
        Returns:
        The BOOLEAN type.
      • counter

        public static DataType counter()
        Returns the COUNTER type.
        Returns:
        The COUNTER type.
      • decimal

        public static DataType decimal()
        Returns the DECIMAL type.
        Returns:
        The DECIMAL type.
      • cdouble

        public static DataType cdouble()
        Returns the DOUBLE type.
        Returns:
        The DOUBLE type.
      • cfloat

        public static DataType cfloat()
        Returns the FLOAT type.
        Returns:
        The FLOAT type.
      • inet

        public static DataType inet()
        Returns the INET type.
        Returns:
        The INET type.
      • tinyint

        public static DataType tinyint()
        Returns the TINYINT type.
        Returns:
        The TINYINT type.
      • smallint

        public static DataType smallint()
        Returns the SMALLINT type.
        Returns:
        The SMALLINT type.
      • cint

        public static DataType cint()
        Returns the INT type.
        Returns:
        The INT type.
      • text

        public static DataType text()
        Returns the TEXT type.
        Returns:
        The TEXT type.
      • timestamp

        public static DataType timestamp()
        Returns the TIMESTAMP type.
        Returns:
        The TIMESTAMP type.
      • date

        public static DataType date()
        Returns the DATE type.
        Returns:
        The DATE type.
      • time

        public static DataType time()
        Returns the TIME type.
        Returns:
        The TIME type.
      • uuid

        public static DataType uuid()
        Returns the UUID type.
        Returns:
        The UUID type.
      • varchar

        public static DataType varchar()
        Returns the VARCHAR type.
        Returns:
        The VARCHAR type.
      • varint

        public static DataType varint()
        Returns the VARINT type.
        Returns:
        The VARINT type.
      • timeuuid

        public static DataType timeuuid()
        Returns the TIMEUUID type.
        Returns:
        The TIMEUUID type.
      • list

        public static DataType.CollectionType list​(DataType elementType,
                                                   boolean frozen)
        Returns the type of lists of elementType elements.
        Parameters:
        elementType - the type of the list elements.
        frozen - whether the list is frozen.
        Returns:
        the type of lists of elementType elements.
      • list

        public static DataType.CollectionType list​(DataType elementType)
        Returns the type of "not frozen" lists of elementType elements.

        This is a shorthand for list(elementType, false);.

        Parameters:
        elementType - the type of the list elements.
        Returns:
        the type of "not frozen" lists of elementType elements.
      • set

        public static DataType.CollectionType set​(DataType elementType,
                                                  boolean frozen)
        Returns the type of sets of elementType elements.
        Parameters:
        elementType - the type of the set elements.
        frozen - whether the set is frozen.
        Returns:
        the type of sets of elementType elements.
      • set

        public static DataType.CollectionType set​(DataType elementType)
        Returns the type of "not frozen" sets of elementType elements.

        This is a shorthand for set(elementType, false);.

        Parameters:
        elementType - the type of the set elements.
        Returns:
        the type of "not frozen" sets of elementType elements.
      • map

        public static DataType.CollectionType map​(DataType keyType,
                                                  DataType valueType,
                                                  boolean frozen)
        Returns the type of maps of keyType to valueType elements.
        Parameters:
        keyType - the type of the map keys.
        valueType - the type of the map values.
        frozen - whether the map is frozen.
        Returns:
        the type of maps of keyType to valueType elements.
      • map

        public static DataType.CollectionType map​(DataType keyType,
                                                  DataType valueType)
        Returns the type of "not frozen" maps of keyType to valueType elements.

        This is a shorthand for map(keyType, valueType, false);.

        Parameters:
        keyType - the type of the map keys.
        valueType - the type of the map values.
        Returns:
        the type of "not frozen" maps of keyType to valueType elements.
      • custom

        public static DataType.CustomType custom​(java.lang.String typeClassName)
        Returns a Custom type.

        A custom type is defined by the name of the class used on the Cassandra side to implement it. Note that the support for custom types by the driver is limited.

        The use of custom types is rarely useful and is thus not encouraged.

        Parameters:
        typeClassName - the server-side fully qualified class name for the type.
        Returns:
        the custom type for typeClassName.
      • duration

        public static DataType duration()
        Returns the Duration type, introduced in Cassandra 3.10.

        Note that a Duration type does not have a native representation in CQL, and technically, is merely a special custom type from the driver's point of view.

        Returns:
        the Duration type. The returned instance is a singleton.
      • getName

        public DataType.Name getName()
        Returns the name of that type.
        Returns:
        the name of that type.
      • isFrozen

        public abstract boolean isFrozen()
        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.

        Returns:
        whether this data type is frozen.
      • isCollection

        public boolean isCollection()
        Returns whether this data type represent a CQL collection type, that is, a list, set or map.
        Returns:
        whether this data type name represent the name of a collection type.
      • getTypeArguments

        public java.util.List<DataType> getTypeArguments()
        Returns the type arguments of this type.

        Note that only the collection types (LIST, MAP, SET) have type arguments. For the other types, this will return an empty list.

        For the collection types:

        • For lists and sets, this method returns one argument, the type of the elements.
        • For maps, this method returns two arguments, the first one is the type of the map keys, the second one is the type of the map values.
        Returns:
        an immutable list containing the type arguments of this type.
      • asFunctionParameterString

        public 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.

        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.

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