public enum DataType extends Enum<DataType>
Enum Constant and Description |
---|
BINARY
Corresponds to a java
byte[] of max length 255 bytes. |
BOOLEAN
Corresponds to a java
Boolean . |
BYTE
Corresponds to a java
Byte . |
COMPLEX_TYPE
Complex type corresponds to a special
LONG autonumber field
which is the key for a secondary table which holds the "real" data. |
DOUBLE
Corresponds to a java
Double . |
FLOAT
Corresponds to a java
Float . |
GUID
Corresponds to a java
String with the pattern
"{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}" , also known as a
"Replication ID" in Access. |
INT
Corresponds to a java
Short . |
LONG
Corresponds to a java
Integer . |
MEMO
Corresponds to a java
String of max length 8388607 chars. |
MONEY
Corresponds to a java
BigDecimal with at most 4 decimal places. |
NUMERIC
Corresponds to a java
BigDecimal . |
OLE
Corresponds to a java
byte[] of max length 16777215 bytes. |
SHORT_DATE_TIME
Corresponds to a java
Date . |
TEXT
Corresponds to a java
String of max length 255 chars. |
UNKNOWN_0D
Unknown data.
|
UNKNOWN_11
Unknown data (seems to be an alternative
OLE type, used by
MSysAccessObjects table). |
UNSUPPORTED_FIXEDLEN
Dummy type for a fixed length type which is not currently supported.
|
UNSUPPORTED_VARLEN
Placeholder type for a variable length type which is not currently
supported.
|
Modifier and Type | Method and Description |
---|---|
static DataType |
fromByte(byte b) |
static DataType |
fromSQLType(int sqlType) |
static DataType |
fromSQLType(int sqlType,
int lengthInUnits) |
int |
fromUnitSize(int unitSize) |
int |
getDefaultPrecision() |
int |
getDefaultScale() |
int |
getDefaultSize() |
int |
getFixedSize() |
int |
getFixedSize(Short colLength) |
boolean |
getHasScalePrecision() |
int |
getMaxPrecision() |
int |
getMaxScale() |
int |
getMaxSize() |
int |
getMinPrecision() |
int |
getMinScale() |
int |
getMinSize() |
int |
getSQLType() |
int |
getUnitSize() |
byte |
getValue() |
boolean |
isLongValue() |
boolean |
isMultipleAutoNumberAllowed() |
boolean |
isTextual() |
boolean |
isTrueVariableLength() |
boolean |
isUnsupported() |
boolean |
isValidPrecision(int precision) |
boolean |
isValidScale(int scale) |
boolean |
isValidSize(int size) |
boolean |
isVariableLength() |
boolean |
mayBeAutoNumber() |
int |
toUnitSize(int size) |
int |
toValidPrecision(int precision) |
int |
toValidScale(int scale) |
int |
toValidSize(int size) |
static DataType |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static DataType[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final DataType BOOLEAN
Boolean
. Accepts Boolean or null
(which is considered false
). Equivalent to SQL Types.BOOLEAN
.public static final DataType BYTE
Byte
. Accepts any Number
(using
Number.byteValue()
), Boolean as 1 or 0, any Object converted to a
String and parsed as Double, or null
. Equivalent to SQL
Types.TINYINT
, Types.BIT
.public static final DataType INT
Short
. Accepts any Number
(using
Number.shortValue()
), Boolean as 1 or 0, any Object converted to a
String and parsed as Double, or null
. Equivalent to SQL
Types.SMALLINT
.public static final DataType LONG
Integer
. Accepts any Number
(using
Number.intValue()
), Boolean as 1 or 0, any Object converted to a
String and parsed as Double, or null
. Equivalent to SQL
Types.INTEGER
, Types.BIGINT
.public static final DataType MONEY
BigDecimal
with at most 4 decimal places.
Accepts any Number
(using Number.doubleValue()
), a
BigInteger, a BigDecimal (with at most 4 decimal places), Boolean as 1 or
0, any Object converted to a String and parsed as BigDecimal, or null
. Equivalent to SQL Types.DECIMAL
.public static final DataType FLOAT
Float
. Accepts any Number
(using
Number.floatValue()
), Boolean as 1 or 0, any Object converted to a
String and parsed as Double, or null
. Equivalent to SQL
Types.FLOAT
.public static final DataType DOUBLE
Double
. Accepts any Number
(using
Number.doubleValue()
), Boolean as 1 or 0, any Object converted to a
String and parsed as Double, or null
. Equivalent to SQL
Types.DOUBLE
, Types.REAL
.public static final DataType SHORT_DATE_TIME
Date
. Accepts a Date, any Number
(using Number.longValue()
), or null
. Equivalent to SQL
Types.TIMESTAMP
, Types.DATE
, Types.TIME
.public static final DataType BINARY
byte[]
of max length 255 bytes. Accepts a
byte[]
, or null
. Equivalent to SQL Types.BINARY
,
Types.VARBINARY
.public static final DataType TEXT
String
of max length 255 chars. Accepts
any CharSequence
, any Object converted to a String , or null
. Equivalent to SQL Types.VARCHAR
, Types.CHAR
.public static final DataType OLE
byte[]
of max length 16777215 bytes.
Accepts a byte[]
, or null
. Equivalent to SQL
Types.LONGVARBINARY
, Types.BLOB
.public static final DataType MEMO
String
of max length 8388607 chars.
Accepts any CharSequence
, any Object converted to a String , or
null
. Equivalent to SQL Types.LONGVARCHAR
, Types.CLOB
.public static final DataType GUID
public static final DataType NUMERIC
BigDecimal
. Accepts any Number
(using Number.doubleValue()
), a BigInteger
, a BigDecimal,
Boolean as 1 or 0, any Object converted to a String and parsed as
BigDecimal, or null
. Equivalent to SQL Types.NUMERIC
.public static final DataType UNKNOWN_11
OLE
type, used by
MSysAccessObjects table). Handled like a fixed length BINARY/OLE.public static final DataType COMPLEX_TYPE
LONG
autonumber field
which is the key for a secondary table which holds the "real" data.public static final DataType UNSUPPORTED_FIXEDLEN
BINARY
.public static DataType[] values()
for (DataType c : DataType.values()) System.out.println(c);
public static DataType valueOf(String name)
name
- the name of the enum constant to be returned.IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is nullpublic byte getValue()
public boolean isVariableLength()
public boolean isTrueVariableLength()
public boolean isLongValue()
public boolean getHasScalePrecision()
public int getFixedSize()
public int getFixedSize(Short colLength)
public int getMinSize()
public int getDefaultSize()
public int getMaxSize()
public int getSQLType() throws SQLException
SQLException
public int getMinScale()
public int getDefaultScale()
public int getMaxScale()
public int getMinPrecision()
public int getDefaultPrecision()
public int getMaxPrecision()
public int getUnitSize()
public int toUnitSize(int size)
public int fromUnitSize(int unitSize)
public boolean isValidSize(int size)
public boolean isValidScale(int scale)
public boolean isValidPrecision(int precision)
public int toValidSize(int size)
public int toValidScale(int scale)
public int toValidPrecision(int precision)
public boolean isTextual()
public boolean mayBeAutoNumber()
public boolean isMultipleAutoNumberAllowed()
public boolean isUnsupported()
public static DataType fromByte(byte b) throws IOException
IOException
public static DataType fromSQLType(int sqlType) throws SQLException
SQLException
public static DataType fromSQLType(int sqlType, int lengthInUnits) throws SQLException
SQLException
Copyright © 2005–2018. All rights reserved.