Class Type (6.55.0)

public final class Type implements Serializable

Describes a type in the Cloud Spanner type system. Types can either be primitive (for example, INT64 and STRING) or composite (for example, ARRAY<INT64> or STRUCT<INT64,STRING>).

Type instances are immutable.

Inheritance

Object > Type

Implements

Serializable

Static Methods

array(Type elementType)

public static Type array(Type elementType)

Returns a descriptor for an array of elementType.

Parameter
NameDescription
elementTypeType
Returns
TypeDescription
Type

bool()

public static Type bool()

Returns the descriptor for the BOOL type.

Returns
TypeDescription
Type

bytes()

public static Type bytes()

Returns the descriptor for the BYTES type: a variable-length byte string.

Returns
TypeDescription
Type

date()

public static Type date()

Returns the descriptor for the DATE type: a timezone independent date in the range [0001-01-01, 9999-12-31).

Returns
TypeDescription
Type

float64()

public static Type float64()

Returns the descriptor for the FLOAT64 type: a floating point type with the same value domain as a Java {code double}.

Returns
TypeDescription
Type

int64()

public static Type int64()

Returns the descriptor for the INT64 type: an integral type with the same value domain as a Java long.

Returns
TypeDescription
Type

json()

public static Type json()

Returns the descriptor for the JSON type.

Returns
TypeDescription
Type

numeric()

public static Type numeric()

Returns the descriptor for the NUMERIC type.

Returns
TypeDescription
Type

pgJsonb()

public static Type pgJsonb()

Returns the descriptor for the JSONB type.

Returns
TypeDescription
Type

pgNumeric()

public static Type pgNumeric()

Returns the descriptor for the NUMERIC type with the PG_NUMERIC type annotation.

Returns
TypeDescription
Type

string()

public static Type string()

Returns the descriptor for the STRING type: a variable-length Unicode character string.

Returns
TypeDescription
Type

struct(Type.StructField[] fields)

public static Type struct(Type.StructField[] fields)

Returns a descriptor for a STRUCT type: an ordered collection of named and typed fields.

Parameter
NameDescription
fieldsStructField[]
Returns
TypeDescription
Type

struct(Iterable<Type.StructField> fields)

public static Type struct(Iterable<Type.StructField> fields)

Returns a descriptor for a STRUCT type: an ordered collection of named and typed fields.

Parameter
NameDescription
fieldsIterable<StructField>
Returns
TypeDescription
Type

timestamp()

public static Type timestamp()

Returns the descriptor for the TIMESTAMP type: a nano precision timestamp in the range [0000-01-01 00:00:00, 9999-12-31 23:59:59.999999999 UTC].

Returns
TypeDescription
Type

Methods

equals(Object o)

public boolean equals(Object o)
Parameter
NameDescription
oObject
Returns
TypeDescription
boolean
Overrides

getArrayElementType()

public Type getArrayElementType()

Returns the type descriptor for elements of this ARRAY type.

Returns
TypeDescription
Type

getCode()

public Type.Code getCode()

Returns the type code corresponding to this type.

Returns
TypeDescription
Type.Code

getFieldIndex(String fieldName)

public int getFieldIndex(String fieldName)

Returns the index of the field named fieldName in this STRUCT type.

Parameter
NameDescription
fieldNameString
Returns
TypeDescription
int

getStructFields()

public List<Type.StructField> getStructFields()

Returns the fields of this STRUCT type.

Returns
TypeDescription
List<StructField>

an immutable list of the fields

hashCode()

public int hashCode()
Returns
TypeDescription
int
Overrides

toString()

public String toString()
Returns
TypeDescription
String
Overrides