public class DBType
extends java.lang.Object
Describe a full column type as it is described in the IVOA document of TAP.
Thus, this object contains 2 attributes: type (or datatype) and length (or size).
The length/size may be not defined ; in this case, its value is set to NO_LENGTH or is negative or null.
All datatypes declared in the IVOA recommendation document of TAP are listed in an enumeration type: DBType.DBDatatype.
It is used to set the attribute type/datatype of this class.
| Modifier and Type | Class and Description |
|---|---|
static class |
DBType.DBDatatype
List of all datatypes declared in the IVOA recommendation of TAP (in the section UPLOAD).
|
| Modifier and Type | Field and Description |
|---|---|
int |
length
The length parameter (only few datatypes need this parameter: char, varchar, binary and varbinary).
|
static int |
NO_LENGTH
Special value in case no length/size is specified.
|
DBType.DBDatatype |
type
Datatype of a column.
|
| Constructor and Description |
|---|
DBType(DBType.DBDatatype datatype)
Build a TAP column type by specifying a datatype.
|
DBType(DBType.DBDatatype datatype,
int length)
Build a TAP column type by specifying a datatype and a length (needed only for datatypes like char, varchar, binary and varbinary).
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
isBinary()
Tells whether this type is a list of bytes.
|
boolean |
isCompatible(DBType t)
Tell whether this
DBType is compatible with the given one. |
boolean |
isGeometry()
Tells whether this type is a geometrical region.
|
boolean |
isNumeric()
Tells whether this type is a numeric.
|
boolean |
isString()
Tells whether this type is about characters.
|
boolean |
isUnknown()
Tell whether this type has been resolved or not.
|
java.lang.String |
toString() |
public static final int NO_LENGTH
public final DBType.DBDatatype type
public final int length
public DBType(DBType.DBDatatype datatype)
datatype - Column datatype.public DBType(DBType.DBDatatype datatype, int length)
datatype - Column datatype.length - Length of the column value (needed only for datatypes like char, varchar, binary and varbinary).public boolean isNumeric()
Tells whether this type is a numeric.
Concerned types:
SMALLINT, INTEGER, BIGINT,
REAL, DOUBLE, BINARY,
VARBINARY and BLOB.
Important note:
Since UNKNOWN is an unresolved type, it can potentially be anything.
But, in order to avoid incorrect operation while expecting a numeric although the type is unknown
and is in fact not really a numeric, this function will return false if the type is
UNKNOWN BUT true if
UNKNOWN_NUMERIC.
true if this type is a numeric, false otherwise.public boolean isBinary()
Tells whether this type is a list of bytes.
Concerned types:
BINARY, VARBINARY and BLOB.
Important note:
Since UNKNOWN is an unresolved type, it can potentially be anything.
But, in order to avoid incorrect operation while expecting a binary although the type is unknown
and is in fact not really a binary, this function will return false if the type is
UNKNOWN or UNKNOWN_NUMERIC.
true if this type is a binary, false otherwise.public boolean isString()
Tells whether this type is about characters.
Concerned types:
CHAR, VARCHAR, CLOB
and TIMESTAMP.
Important note:
Since UNKNOWN is an unresolved type, it can potentially be anything.
But, in order to avoid incorrect operation while expecting a string although the type is unknown
and is in fact not really a string, this function will return false if the type is
UNKNOWN or UNKNOWN_NUMERIC
true if this type is a string, false otherwise.public boolean isGeometry()
Tells whether this type is a geometrical region.
Concerned types:
POINT and REGION.
Important note:
Since UNKNOWN is an unresolved type, it can potentially be anything.
But, in order to avoid incorrect operation while expecting a geometry although the type is unknown
and is in fact not really a geometry, this function will return false if the type is
UNKNOWN or UNKNOWN_NUMERIC.
true if this type is a geometry, false otherwise.public boolean isUnknown()
Tell whether this type has been resolved or not.
Concerned types:
UNKNOWN and UNKNOWN_NUMERIC.
true if this type has NOT been resolved, false otherwise.public boolean isCompatible(DBType t)
Tell whether this DBType is compatible with the given one.
Two DBTypes are said compatible if they are both binary, numeric, geometric or string.
If one of the two types is unknown or unknown_numeric,
this function will consider them as compatible and will return true.
t - The type to compare to.true if this type is compatible with the given one, false otherwise.public java.lang.String toString()
toString in class java.lang.Object