Class DBType
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.
- Since:
- 1.3
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
List of all datatypes declared in the IVOA recommendation of TAP (in the section UPLOAD). -
Field Summary
FieldsModifier and TypeFieldDescriptionfinal int
The length parameter (only few datatypes need this parameter: char, varchar, binary and varbinary).static final int
Special value in case no length/size is specified.final DBType.DBDatatype
Datatype of a column. -
Constructor Summary
ConstructorsConstructorDescriptionDBType
(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). -
Method Summary
Modifier and TypeMethodDescriptionboolean
isBinary()
Tells whether this type is a list of bytes.boolean
Tell whether thisDBType
is compatible with the given one.boolean
Tells whether this type is a geometrical region.boolean
Tells whether this type is a numeric.boolean
isString()
Tells whether this type is about characters.boolean
Tell whether this type has been resolved or not.toString()
-
Field Details
-
NO_LENGTH
public static final int NO_LENGTHSpecial value in case no length/size is specified.- See Also:
-
type
Datatype of a column. -
length
public final int lengthThe length parameter (only few datatypes need this parameter: char, varchar, binary and varbinary).
-
-
Constructor Details
-
DBType
Build a TAP column type by specifying a datatype.- Parameters:
datatype
- Column datatype.
-
DBType
Build a TAP column type by specifying a datatype and a length (needed only for datatypes like char, varchar, binary and varbinary).- Parameters:
datatype
- Column datatype.length
- Length of the column value (needed only for datatypes like char, varchar, binary and varbinary).
-
-
Method Details
-
isNumeric
public boolean isNumeric()Tells whether this type is a numeric.
Concerned types:
SMALLINT
,INTEGER
,BIGINT
,REAL
,DOUBLE
,BINARY
,VARBINARY
andBLOB
.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 returnfalse
if the type isUNKNOWN
BUTtrue
ifUNKNOWN_NUMERIC
.- Returns:
true
if this type is a numeric,false
otherwise.
-
isBinary
public boolean isBinary()Tells whether this type is a list of bytes.
Concerned types:
BINARY
,VARBINARY
andBLOB
.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 returnfalse
if the type isUNKNOWN
orUNKNOWN_NUMERIC
.- Returns:
true
if this type is a binary,false
otherwise.
-
isString
public boolean isString()Tells whether this type is about characters.
Concerned types:
CHAR
,VARCHAR
,CLOB
andTIMESTAMP
.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 returnfalse
if the type isUNKNOWN
orUNKNOWN_NUMERIC
- Returns:
true
if this type is a string,false
otherwise.
-
isGeometry
public boolean isGeometry()Tells whether this type is a geometrical region.Concerned types:
POINT
,CIRCLE
,POLYGON
andREGION
.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 returnfalse
if the type isUNKNOWN
orUNKNOWN_NUMERIC
.- Returns:
true
if this type is a geometry,false
otherwise.
-
isUnknown
public boolean isUnknown()Tell whether this type has been resolved or not.
Concerned types:
UNKNOWN
andUNKNOWN_NUMERIC
.- Returns:
true
if this type has NOT been resolved,false
otherwise.- Since:
- 1.4
-
isCompatible
Tell whether this
DBType
is compatible with the given one.Two
DBType
s are said compatible if they are both binary, numeric, geometric or string. If one of the two types isunknown
orunknown_numeric
, this function will consider them as compatible and will returntrue
.- Parameters:
t
- The type to compare to.- Returns:
true
if this type is compatible with the given one,false
otherwise.
-
toString
-