public interface EdmPrimitiveType extends EdmType
EDM primitive type | Java types |
---|---|
Binary | byte[], Byte [] |
Boolean | Boolean |
Byte | Short , Byte , Integer , Long , BigInteger
|
Date | Calendar , Date , Timestamp ,
Time , Long |
DateTimeOffset | Timestamp , Calendar , Date ,
Time , Long |
Decimal | BigDecimal , BigInteger , Double , Float ,
Byte , Short , Integer , Long |
Double | Double , Float , BigDecimal , Byte , Short ,
Integer , Long |
Duration | BigDecimal , BigInteger , Double , Float ,
Byte , Short , Integer , Long |
Guid | UUID |
Int16 | Short , Byte , Integer , Long , BigInteger
|
Int32 | Integer , Byte , Short , Long , BigInteger
|
Int64 | Long , Byte , Short , Integer , BigInteger
|
SByte | Byte , Short , Integer , Long , BigInteger
|
Single | Float , Double , BigDecimal , Byte , Short ,
Integer , Long |
String | String |
TimeOfDay | Calendar , Date , Timestamp ,
Time , Long |
The first Java type is the default type for the respective EDM primitive type.
For all EDM primitive types, the Nullable
facet is taken into account. For Binary
and
String
, MaxLength
is also applicable. For String
, the facet
Unicode
is considered additionally. The EDM primitive types DateTimeOffset
,
Decimal
, Duration
, and TimeOfDay
can have a Precision
facet.
Additionally, Decimal
can have the facet Scale
.
Modifier and Type | Field and Description |
---|---|
static String |
EDM_NAMESPACE |
Modifier and Type | Method and Description |
---|---|
String |
fromUriLiteral(String literal)
Converts URI literal representation to default literal representation.
|
Class<?> |
getDefaultType()
Returns the default Java type for this EDM primitive type as described in the documentation of
EdmPrimitiveType . |
boolean |
isCompatible(EdmPrimitiveType primitiveType)
Checks type compatibility.
|
String |
toUriLiteral(String literal)
Converts default literal representation to URI literal representation.
|
boolean |
validate(String value,
Boolean isNullable,
Integer maxLength,
Integer precision,
Integer scale,
Boolean isUnicode)
Validates literal value.
|
<T> T |
valueOfString(String value,
Boolean isNullable,
Integer maxLength,
Integer precision,
Integer scale,
Boolean isUnicode,
Class<T> returnType)
Converts literal representation of value to system data type.
|
String |
valueToString(Object value,
Boolean isNullable,
Integer maxLength,
Integer precision,
Integer scale,
Boolean isUnicode)
Converts system data type to literal representation of value.
|
getFullQualifiedName, getKind, getNamespace
static final String EDM_NAMESPACE
boolean isCompatible(EdmPrimitiveType primitiveType)
primitiveType
- the EdmPrimitiveType
to be tested for compatibilitytrue
if the provided type is compatible to this typeClass<?> getDefaultType()
EdmPrimitiveType
.boolean validate(String value, Boolean isNullable, Integer maxLength, Integer precision, Integer scale, Boolean isUnicode)
value
- the literal valueisNullable
- whether the null
value is allowedmaxLength
- the maximum lengthprecision
- the precisionscale
- the scaleisUnicode
- whether non-ASCII characters are allowed (relevant only for Edm.String)true
if the validation is successful<T> T valueOfString(String value, Boolean isNullable, Integer maxLength, Integer precision, Integer scale, Boolean isUnicode, Class<T> returnType) throws EdmPrimitiveTypeException
value
- the literal representation of valueisNullable
- whether the null
value is allowedmaxLength
- the maximum lengthprecision
- the precisionscale
- the scaleisUnicode
- whether non-ASCII characters are allowed (relevant only for Edm.String)returnType
- the class of the returned value; it must be one of the list in the documentation of
EdmPrimitiveType
returnType
indicatesEdmPrimitiveTypeException
String valueToString(Object value, Boolean isNullable, Integer maxLength, Integer precision, Integer scale, Boolean isUnicode) throws EdmPrimitiveTypeException
Returns null
if value is null
and null
is an allowed value.
value
- the Java value as Object; its type must be one of the list in the documentation of
EdmPrimitiveType
isNullable
- whether the null
value is allowedmaxLength
- the maximum lengthprecision
- the precisionscale
- the scaleisUnicode
- whether non-ASCII characters are allowed (relevant only for Edm.String)EdmPrimitiveTypeException
String toUriLiteral(String literal)
Returns null
if the literal is null
. Does not perform any validation.
literal
- the literal in default representationString fromUriLiteral(String literal) throws EdmPrimitiveTypeException
Returns null
if the literal is null
. Checks the presence of a required prefix and of
required surrounding quotation marks but does not perform any further validation.
literal
- the literal in URI representationEdmPrimitiveTypeException
- if a required prefix or required surrounding quotation marks are missingCopyright © 2013–2018 The Apache Software Foundation. All rights reserved.