Send feedback
Class Type (6.102.0)
Stay organized with collections
Save and categorize content based on your preferences.
Version latestkeyboard_arrow_down
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.
Static Methods
array(Type elementType)
public static Type array ( Type elementType )
Returns a descriptor for an array of elementType.
Parameter
Name
Description
elementType
Type
Returns
Type
Description
Type
bool()
public static Type bool ()
Returns the descriptor for the BOOL type.
Returns
Type
Description
Type
bytes()
public static Type bytes ()
Returns the descriptor for the BYTES type: a variable-length byte string.
Returns
Type
Description
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
Type
Description
Type
float32()
public static Type float32 ()
Returns the descriptor for the FLOAT32 type: a floating point type with the same value
domain as a Java float.
Returns
Type
Description
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 double.
Returns
Type
Description
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
Type
Description
Type
interval()
public static Type interval ()
Returns the descriptor for the INTERVAL type: an interval which represents a time
duration as a tuple of 3 values (months, days, nanoseconds). [Interval(months:-120000, days:
-3660000, nanoseconds: -316224000000000000000), Interval(months:120000, days: 3660000,
nanoseconds: 316224000000000000000)].
Returns
Type
Description
Type
json()
public static Type json ()
Returns the descriptor for the JSON type.
Returns
Type
Description
Type
numeric()
public static Type numeric ()
Returns the descriptor for the NUMERIC type.
Returns
Type
Description
Type
pgJsonb()
public static Type pgJsonb ()
Returns the descriptor for the JSONB type.
Returns
Type
Description
Type
pgNumeric()
public static Type pgNumeric ()
Returns the descriptor for the NUMERIC type with the PG_NUMERIC type
annotation.
Returns
Type
Description
Type
pgOid()
public static Type pgOid ()
Returns the descriptor for the PG_OID type.
Returns
Type
Description
Type
proto(String protoTypeFqn)
public static Type proto ( String protoTypeFqn )
To get the descriptor for the PROTO type.
Parameter
Name
Description
protoTypeFqn
String Proto fully qualified name (ex: "examples.spanner.music.SingerInfo").
Returns
Type
Description
Type
protoEnum(String protoTypeFqn)
public static Type protoEnum ( String protoTypeFqn )
To get the descriptor for the ENUM type.
Parameter
Name
Description
protoTypeFqn
String Proto ENUM fully qualified name (ex: "examples.spanner.music.Genre")
Returns
Type
Description
Type
string()
public static Type string ()
Returns the descriptor for the STRING type: a variable-length Unicode character string.
Returns
Type
Description
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.
Returns
Type
Description
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.
Returns
Type
Description
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
Type
Description
Type
uuid()
public static Type uuid ()
Returns the descriptor for the UUID type.
Returns
Type
Description
Type
Methods
equals(Object o)
public boolean equals ( Object o )
Parameter
Name
Description
o
Object
Overrides
getArrayElementType()
public Type getArrayElementType ()
Returns the type descriptor for elements of this ARRAY type.
Returns
Type
Description
Type
getCode()
public Type . Code getCode ()
Returns the type code corresponding to this type.
getFieldIndex(String fieldName)
public int getFieldIndex ( String fieldName )
Returns the index of the field named fieldName in this STRUCT type.
Parameter
Name
Description
fieldName
String
Returns
Type
Description
int
getProtoTypeFqn()
public String getProtoTypeFqn ()
Returns the full package name for elements of this Proto or @code Enum type.
Returns
Type
Description
String
getSpannerTypeName(Dialect dialect)
public String getSpannerTypeName ( Dialect dialect )
Returns the type name as used by the database in the given dialect.
Parameter
Name
Description
dialect
Dialect
Returns
Type
Description
String
getStructFields()
public List<Type . StructField > getStructFields ()
Returns the fields of this STRUCT type.
hashCode()
Returns
Type
Description
int
Overrides
toString()
Returns
Type
Description
String
Overrides
Send feedback
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License , and code samples are licensed under the Apache 2.0 License . For details, see the Google Developers Site Policies . Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-10-11 UTC.
Need to tell us more?
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-10-11 UTC."],[],[]]