Package com.gpudb
Class Type.Column
- java.lang.Object
-
- com.gpudb.Type.Column
-
- All Implemented Interfaces:
Serializable
- Enclosing class:
- Type
public static final class Type.Column extends Object implements Serializable
Immutable collection of metadata about a column that is part of a GPUdb type.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classType.Column.ColumnBaseTypeAn enumeration of base types for column (excluding any property-related subtypes).static classType.Column.ColumnTypeAn enumeration of all the Kinetica column types (including sub-types that are determined by the properties used).
-
Field Summary
Fields Modifier and Type Field Description static intDECIMAL8_MAX_PRECISIONstatic BigDecimalDEFAULT_DECIMAL_MAXstatic BigDecimalDEFAULT_DECIMAL_MINstatic intDEFAULT_DECIMAL_PRECISIONstatic intDEFAULT_DECIMAL_SCALE
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object obj)Type.Column.ColumnTypegetArrayType()Get the sub-type of the arrayType.Column.ColumnBaseTypegetColumnBaseType()Gets the enumeration of the *base* type of the column.Type.Column.ColumnTypegetColumnType()Gets the enumeration of the type of the column.intgetDecimalPrecision()intgetDecimalScale()StringgetName()Gets the name of the column.List<String>getProperties()Gets the list of properties that apply to the column.Class<?>getType()Gets the Java data type of the column.intgetVectorDimensions()Get vector datatype dimensions, -1 if not a vectorinthashCode()booleanhasProperty(String property)Checks if the given property applies to the column.booleanisArray()Determine if the column is an Array typebooleanisDecimal()booleanisNullable()Gets whether the column is nullable.booleanisVector()Determine if the column is a Vector typeStringtoString()
-
-
-
Field Detail
-
DEFAULT_DECIMAL_PRECISION
public static final int DEFAULT_DECIMAL_PRECISION
- See Also:
- Constant Field Values
-
DEFAULT_DECIMAL_SCALE
public static final int DEFAULT_DECIMAL_SCALE
- See Also:
- Constant Field Values
-
DEFAULT_DECIMAL_MIN
public static final BigDecimal DEFAULT_DECIMAL_MIN
-
DEFAULT_DECIMAL_MAX
public static final BigDecimal DEFAULT_DECIMAL_MAX
-
DECIMAL8_MAX_PRECISION
public static final int DECIMAL8_MAX_PRECISION
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
Column
public Column(String name, Class<?> type, String... properties)
Creates aType.Columnobject with the specified metadata.- Parameters:
name- the name of the columntype- the Java data type of the columnproperties- the list of properties that apply to the column; defaults to none- Throws:
IllegalArgumentException- ifnameor anypropertiesare invalid, or iftypeis not one of the following:ByteBuffer,Double,Float,Integer,Long, orString- See Also:
ColumnProperty
-
Column
public Column(String name, Class<?> type, List<String> properties)
Creates aType.Columnobject with the specified metadata.- Parameters:
name- the name of the columntype- the Java data type of the columnproperties- the list of properties that apply to the column; defaults to none- Throws:
IllegalArgumentException- ifnameor anypropertiesare invalid, or iftypeis not one of the following:ByteBuffer,Double,Float,Integer,Long, orString- See Also:
ColumnProperty
-
-
Method Detail
-
getName
public String getName()
Gets the name of the column.- Returns:
- the name of the column
-
getType
public Class<?> getType()
Gets the Java data type of the column.- Returns:
- the Java data type of the column
-
getColumnBaseType
public Type.Column.ColumnBaseType getColumnBaseType()
Gets the enumeration of the *base* type of the column. This is far more efficient than usinggetType()and then comparing it to various Java classes, e.g. Integer.class. With this enumeration, switch statements can be used to do different things for different column types. This enumeration is preferred when the same thing needs to be done for all sub-types of a given base type. For example, string has a lot of sub-types; rather than having to group multiple case statements (and ensuring that no applicable enumeration is missed) forType.Column.ColumnType, this enumeration can be used to cover all string cases.- Returns:
- the enumeration representing the *base* type of the column
-
getColumnType
public Type.Column.ColumnType getColumnType()
Gets the enumeration of the type of the column. This is far more efficient than usinghasProperty(String)to check for given column properties. With this enumeration, switch statements can be used to do different things for different column types.- Returns:
- the enumeration representing the type of the column
-
isDecimal
public boolean isDecimal()
-
getDecimalPrecision
public int getDecimalPrecision()
-
getDecimalScale
public int getDecimalScale()
-
isNullable
public boolean isNullable()
Gets whether the column is nullable.- Returns:
- whether the column is nullable
-
isArray
public boolean isArray()
Determine if the column is an Array type- Returns:
- True if the column is an Array
-
getArrayType
public Type.Column.ColumnType getArrayType() throws GPUdbException
Get the sub-type of the array- Returns:
- The ColumnBaseType of the array sub-type. Returns null if column is not an Array
- Throws:
GPUdbException
-
getProperties
public List<String> getProperties()
Gets the list of properties that apply to the column.- Returns:
- the list of properties that apply to the column
- See Also:
ColumnProperty
-
isVector
public boolean isVector()
Determine if the column is a Vector type- Returns:
- True if the column is a Vector type
-
getVectorDimensions
public int getVectorDimensions()
Get vector datatype dimensions, -1 if not a vector- Returns:
- Size of the vector, -1 if not a vector
-
hasProperty
public boolean hasProperty(String property)
Checks if the given property applies to the column.- Returns:
- boolean indicating whether the given property exists in the column's properties.
- See Also:
ColumnProperty
-
-