org.apache.cassandra.db.marshal

## Class UserType

- java.lang.Object
- - org.apache.cassandra.db.marshal.AbstractType<java.nio.ByteBuffer>
  - - org.apache.cassandra.db.marshal.TupleType
    - - org.apache.cassandra.db.marshal.UserType

All Implemented Interfaces:
  java.util.Comparator<java.nio.ByteBuffer>

    public class UserType
    extends TupleType

A user defined type. A user type is really just a tuple type on steroids.

### Field Summary

Fields
`java.lang.String` `keyspace`
`java.nio.ByteBuffer` `name`

### Fields inherited from class org.apache.cassandra.db.marshal.TupleType

`types`

### Fields inherited from class org.apache.cassandra.db.marshal.AbstractType

`reverseComparator`

### Constructor Summary

Constructors
Constructor and Description
`UserType(java.lang.String keyspace, java.nio.ByteBuffer name, java.util.List<java.nio.ByteBuffer> fieldNames, java.util.List<AbstractType<?>> fieldTypes)`

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`CQL3Type` `asCQL3Type()`
`boolean` `equals(java.lang.Object o)`
`java.nio.ByteBuffer` `fieldName(int i)`
`java.lang.String` `fieldNameAsString(int i)`
`java.util.List<java.nio.ByteBuffer>` `fieldNames()`
`AbstractType<?>` `fieldType(int i)`
`java.util.List<AbstractType<?>>` `fieldTypes()`
`Term` `fromJSONObject(java.lang.Object parsed)` Given a parsed JSON string, return a byte representation of the object.
`static UserType` `getInstance(TypeParser parser)`
`java.lang.String` `getNameAsString()`
`TypeSerializer<java.nio.ByteBuffer>` `getSerializer()`
`int` `hashCode()`
`java.lang.String` `toJSONString(java.nio.ByteBuffer buffer, int protocolVersion)` Converts the specified value into its JSON representation.
`java.lang.String` `toString()` This must be overriden by subclasses if necessary so that for any AbstractType, this == TypeParser.parse(toString()).

### Methods inherited from class org.apache.cassandra.db.marshal.TupleType

`allTypes, buildValue, compare, fromString, getString, isCompatibleWith, isValueCompatibleWithInternal, references, size, split, type`

### Methods inherited from class org.apache.cassandra.db.marshal.AbstractType

`asCQLTypeStringList, compareCollectionMembers, componentsCount, compose, decompose, freeze, getComponents, getString, isByteOrderComparable, isCollection, isCounter, isEmptyValueMeaningless, isFrozenCollection, isMultiCell, isReversed, isValueCompatibleWith, parseDefaultParameters, toString, validate, validateCellValue, validateCollectionMember`

### Methods inherited from class java.lang.Object

`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

### Methods inherited from interface java.util.Comparator

`comparing, comparing, comparingDouble, comparingInt, comparingLong, naturalOrder, nullsFirst, nullsLast, reversed, reverseOrder, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong`

### Field Detail

#### keyspace

    public final java.lang.String keyspace

#### name

    public final java.nio.ByteBuffer name

### Constructor Detail

#### UserType

    public UserType(java.lang.String keyspace,
                    java.nio.ByteBuffer name,
                    java.util.List<java.nio.ByteBuffer> fieldNames,
                    java.util.List<AbstractType<?>> fieldTypes)

### Method Detail

#### getInstance

    public static UserType getInstance(TypeParser parser)
                                throws ConfigurationException,
                                       SyntaxException

Throws:
  `ConfigurationException`
  `SyntaxException`

#### fieldType

    public AbstractType<?> fieldType(int i)

#### fieldTypes

    public java.util.List<AbstractType<?>> fieldTypes()

#### fieldName

    public java.nio.ByteBuffer fieldName(int i)

#### fieldNameAsString

    public java.lang.String fieldNameAsString(int i)

#### fieldNames

    public java.util.List<java.nio.ByteBuffer> fieldNames()

#### getNameAsString

    public java.lang.String getNameAsString()

#### fromJSONObject

    public Term fromJSONObject(java.lang.Object parsed)
                        throws MarshalException

Description copied from class: `AbstractType`
Given a parsed JSON string, return a byte representation of the object.

Overrides:
  `fromJSONObject` in class `TupleType`
Parameters:
  `parsed` - the result of parsing a json string
Throws:
  `MarshalException`

#### toJSONString

    public java.lang.String toJSONString(java.nio.ByteBuffer buffer,
                                         int protocolVersion)

Description copied from class: `AbstractType`
Converts the specified value into its JSON representation.

The buffer position will stay the same.

Overrides:
  `toJSONString` in class `TupleType`
Parameters:
  `buffer` - the value to convert
  `protocolVersion` - the protocol version to use for the conversion
Returns:
  a JSON string representing the specified value

#### hashCode

    public int hashCode()

Overrides:
  `hashCode` in class `TupleType`

#### equals

    public boolean equals(java.lang.Object o)

Specified by:
  `equals` in interface `java.util.Comparator<java.nio.ByteBuffer>`
Overrides:
  `equals` in class `TupleType`

#### asCQL3Type

    public CQL3Type asCQL3Type()

Overrides:
  `asCQL3Type` in class `TupleType`

#### toString

    public java.lang.String toString()

Description copied from class: `AbstractType`
This must be overriden by subclasses if necessary so that for any AbstractType, this == TypeParser.parse(toString()). Note that for backwards compatibility this includes the full classname. For CQL purposes the short name is fine.

Overrides:
  `toString` in class `TupleType`

#### getSerializer

    public TypeSerializer<java.nio.ByteBuffer> getSerializer()

Overrides:
  `getSerializer` in class `TupleType`