Class UDFDataType

java.lang.Object
org.apache.cassandra.cql3.functions.UDFDataType

public final class UDFDataType extends Object
Represents a data type used within the UDF/UDA.

Internaly, UDFs and UDAs use the Java driver types. This class maintains the mapping between the C* type and the corresponding java driver type.
  • Method Details

    • toAbstractType

      public AbstractType<?> toAbstractType()
      Converts this type into the corresponding Cassandra type.
      Returns:
      the corresponding Cassandra type
    • toJavaClass

      public Class<?> toJavaClass()
      Converts this type into the corresponding Java class.
      Returns:
      the corresponding Java class.
    • getJavaTypeName

      public String getJavaTypeName()
      Returns:
      the name of the java type corresponding to this class.
    • isPrimitive

      public boolean isPrimitive()
      Checks if this type is corresponding to a Java primitive type.
      Returns:
      true if this type is corresponding to a Java primitive type, false otherwise.
    • wrap

      public static UDFDataType wrap(AbstractType<?> abstractType, boolean usePrimitive)
      Returns the UDFDataType corresponding to the specified type.
      Parameters:
      abstractType - the Cassandra type
      usePrimitive - true if the primitive type can be used.
      Returns:
      the UDFDataType corresponding to the specified type.
    • wrap

      public static List<UDFDataType> wrap(List<AbstractType<?>> argTypes, boolean usePrimitive)
      Returns the UDFDataTypes corresponding to the specified types.
      Parameters:
      argTypes - the Cassandra types
      usePrimitive - true if the primitive types can be used.
      Returns:
      the UDFDataTypes corresponding to the specified types.
    • toDataType

      public DataType toDataType()
      Converts this type into the corresponding Java driver type.
      Returns:
      the corresponding Java driver type.
    • hashCode

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

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • compose

      public Object compose(ProtocolVersion protocolVersion, ByteBuffer buffer)
      Deserializes the specified oject.
      Parameters:
      protocolVersion - the protocol version
      buffer - the serialized object
      Returns:
      the deserialized object
    • decompose

      public ByteBuffer decompose(ProtocolVersion protocolVersion, Object value)
      Serialized the specified oject.
      Parameters:
      protocolVersion - the protocol version
      value - the value to serialize
      Returns:
      the serialized object
    • decompose

      public ByteBuffer decompose(ProtocolVersion protocolVersion, byte value)
      Serialized the specified byte.
      Parameters:
      protocolVersion - the protocol version
      value - the value to serialize
      Returns:
      the serialized byte
    • decompose

      public ByteBuffer decompose(ProtocolVersion protocolVersion, short value)
      Serialized the specified byte.
      Parameters:
      protocolVersion - the protocol version
      value - the value to serialize
      Returns:
      the serialized byte
    • decompose

      public ByteBuffer decompose(ProtocolVersion protocolVersion, int value)
      Serialized the specified byte.
      Parameters:
      protocolVersion - the protocol version
      value - the value to serialize
      Returns:
      the serialized byte
    • decompose

      public ByteBuffer decompose(ProtocolVersion protocolVersion, long value)
      Serialized the specified byte.
      Parameters:
      protocolVersion - the protocol version
      value - the value to serialize
      Returns:
      the serialized byte
    • decompose

      public ByteBuffer decompose(ProtocolVersion protocolVersion, float value)
      Serialized the specified byte.
      Parameters:
      protocolVersion - the protocol version
      value - the value to serialize
      Returns:
      the serialized byte
    • decompose

      public ByteBuffer decompose(ProtocolVersion protocolVersion, double value)
      Serialized the specified byte.
      Parameters:
      protocolVersion - the protocol version
      value - the value to serialize
      Returns:
      the serialized byte
    • getArgumentDeserializer

      public ArgumentDeserializer getArgumentDeserializer()