Class AbstractSimpleType
java.lang.Object
org.apache.olingo.odata2.core.edm.AbstractSimpleType
- All Implemented Interfaces:
EdmNamed,EdmSimpleType,EdmType
- Direct Known Subclasses:
Bit,EdmBinary,EdmBoolean,EdmByte,EdmDateTime,EdmDateTimeOffset,EdmDecimal,EdmDouble,EdmGuid,EdmInt16,EdmInt32,EdmInt64,EdmNull,EdmSByte,EdmSingle,EdmString,EdmTime,Uint7
Abstract implementation of the EDM simple-type interface.
-
Field Summary
Fields inherited from interface org.apache.olingo.odata2.api.edm.EdmSimpleType
EDM_NAMESPACE, SYSTEM_NAMESPACE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleangetKind()getName()Namespace of thisEdmTypeinthashCode()protected abstract <T> TinternalValueOfString(String value, EdmLiteralKind literalKind, EdmFacets facets, Class<T> returnType) protected abstract <T> StringinternalValueToString(T value, EdmLiteralKind literalKind, EdmFacets facets) booleanisCompatible(EdmSimpleType simpleType) Checks type compatibility.toString()toUriLiteral(String literal) Converts default literal representation to URI literal representation.booleanvalidate(String value, EdmLiteralKind literalKind, EdmFacets facets) Validates literal value.final <T> TvalueOfString(String value, EdmLiteralKind literalKind, EdmFacets facets, Class<T> returnType) Converts literal representation of value to system data type.final StringvalueToString(Object value, EdmLiteralKind literalKind, EdmFacets facets) Converts system data type to literal representation of value.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.olingo.odata2.api.edm.EdmSimpleType
getDefaultType
-
Constructor Details
-
AbstractSimpleType
public AbstractSimpleType()
-
-
Method Details
-
equals
-
hashCode
public int hashCode() -
getNamespace
Description copied from interface:EdmTypeNamespace of thisEdmType- Specified by:
getNamespacein interfaceEdmType- Returns:
- namespace as String
- Throws:
EdmException
-
getKind
- Specified by:
getKindin interfaceEdmType- Returns:
EdmTypeKindof thisEdmType
-
getName
- Specified by:
getNamein interfaceEdmNamed- Returns:
- name as String
- Throws:
EdmException
-
isCompatible
Description copied from interface:EdmSimpleTypeChecks type compatibility.- Specified by:
isCompatiblein interfaceEdmSimpleType- Parameters:
simpleType- theEdmSimpleTypeto be tested for compatibility- Returns:
trueif the provided type is compatible to this type
-
validate
Description copied from interface:EdmSimpleTypeValidates literal value.- Specified by:
validatein interfaceEdmSimpleType- Parameters:
value- the literal valueliteralKind- the kind of literal representation of valuefacets- additional constraints for parsing (optional)- Returns:
trueif the validation is successful- See Also:
-
valueOfString
public final <T> T valueOfString(String value, EdmLiteralKind literalKind, EdmFacets facets, Class<T> returnType) throws EdmSimpleTypeException Description copied from interface:EdmSimpleTypeConverts literal representation of value to system data type.- Specified by:
valueOfStringin interfaceEdmSimpleType- Parameters:
value- the literal representation of valueliteralKind- the kind of literal representation of valuefacets- additional constraints for parsing (optional)returnType- the class of the returned value; it must be one of the list in the documentation ofEdmSimpleType- Returns:
- the value as an instance of the class the parameter
returnTypeindicates - Throws:
EdmSimpleTypeException- See Also:
-
internalValueOfString
protected abstract <T> T internalValueOfString(String value, EdmLiteralKind literalKind, EdmFacets facets, Class<T> returnType) throws EdmSimpleTypeException - Throws:
EdmSimpleTypeException
-
valueToString
public final String valueToString(Object value, EdmLiteralKind literalKind, EdmFacets facets) throws EdmSimpleTypeException Description copied from interface:EdmSimpleTypeConverts system data type to literal representation of value.
Returns
nullif value isnulland the facets allow thenullvalue.- Specified by:
valueToStringin interfaceEdmSimpleType- Parameters:
value- the Java value as Object; its type must be one of the list in the documentation ofEdmSimpleTypeliteralKind- the requested kind of literal representationfacets- additional constraints for formatting (optional)- Returns:
- literal representation as String
- Throws:
EdmSimpleTypeException- See Also:
-
internalValueToString
protected abstract <T> String internalValueToString(T value, EdmLiteralKind literalKind, EdmFacets facets) throws EdmSimpleTypeException - Throws:
EdmSimpleTypeException
-
toUriLiteral
Description copied from interface:EdmSimpleTypeConverts default literal representation to URI literal representation.- Specified by:
toUriLiteralin interfaceEdmSimpleType- Parameters:
literal- the literal in default representation- Returns:
- URI literal representation as String
- Throws:
EdmSimpleTypeException
-
toString
-