Class AbstractGeospatialType<T extends Geospatial>
java.lang.Object
org.apache.olingo.commons.core.edm.primitivetype.SingletonPrimitiveType
org.apache.olingo.commons.core.edm.primitivetype.AbstractGeospatialType<T>
- All Implemented Interfaces:
EdmNamed,EdmPrimitiveType,EdmType
- Direct Known Subclasses:
EdmGeography,EdmGeographyCollection,EdmGeographyLineString,EdmGeographyMultiLineString,EdmGeographyMultiPoint,EdmGeographyMultiPolygon,EdmGeographyPoint,EdmGeographyPolygon,EdmGeometry,EdmGeometryCollection,EdmGeometryLineString,EdmGeometryMultiLineString,EdmGeometryMultiPoint,EdmGeometryMultiPolygon,EdmGeometryPoint,EdmGeometryPolygon
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final Geospatial.Dimensionprotected FullQualifiedNameprotected final Geospatial.Typeprotected Stringprotected StringFields inherited from class org.apache.olingo.commons.core.edm.primitivetype.SingletonPrimitiveType
nameFields inherited from interface org.apache.olingo.commons.api.edm.EdmPrimitiveType
EDM_NAMESPACE -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractGeospatialType(Class<T> reference, Geospatial.Dimension dimension, Geospatial.Type type) -
Method Summary
Modifier and TypeMethodDescriptionfromUriLiteral(String literal) Converts URI literal representation to default literal representation.Class<?>Returns the default Java type for this EDM primitive type as described in the documentation ofEdmPrimitiveType.protected abstract <T> TinternalValueOfString(String value, Boolean isNullable, Integer maxLength, Integer precision, Integer scale, Boolean isUnicode, Class<T> returnType) protected abstract <T> StringinternalValueToString(T value, Boolean isNullable, Integer maxLength, Integer precision, Integer scale, Boolean isUnicode) booleanisCompatible(EdmPrimitiveType primitiveType) Checks type compatibility.protected GeospatialCollectionstringToCollection(String value, Boolean isNullable, Integer maxLength, Integer precision, Integer scale, Boolean isUnicode) protected LineStringstringToLineString(String value, Boolean isNullable, Integer maxLength, Integer precision, Integer scale, Boolean isUnicode) protected MultiLineStringstringToMultiLineString(String value, Boolean isNullable, Integer maxLength, Integer precision, Integer scale, Boolean isUnicode) protected MultiPointstringToMultiPoint(String value, Boolean isNullable, Integer maxLength, Integer precision, Integer scale, Boolean isUnicode) protected MultiPolygonstringToMultiPolygon(String value, Boolean isNullable, Integer maxLength, Integer precision, Integer scale, Boolean isUnicode) protected PointstringToPoint(String value, Boolean isNullable, Integer maxLength, Integer precision, Integer scale, Boolean isUnicode) protected PolygonstringToPolygon(String value, Boolean isNullable, Integer maxLength, Integer precision, Integer scale, Boolean isUnicode) toString()protected StringtoString(GeospatialCollection collection, Boolean isNullable, Integer maxLength, Integer precision, Integer scale, Boolean isUnicode) protected StringtoString(LineString lineString, Boolean isNullable, Integer maxLength, Integer precision, Integer scale, Boolean isUnicode) protected StringtoString(MultiLineString multiLineString, Boolean isNullable, Integer maxLength, Integer precision, Integer scale, Boolean isUnicode) protected StringtoString(MultiPoint multiPoint, Boolean isNullable, Integer maxLength, Integer precision, Integer scale, Boolean isUnicode) protected StringtoString(MultiPolygon multiPolygon, Boolean isNullable, Integer maxLength, Integer precision, Integer scale, Boolean isUnicode) protected StringtoString(Point point, Boolean isNullable, Integer maxLength, Integer precision, Integer scale, Boolean isUnicode) protected StringtoString(Polygon polygon, Boolean isNullable, Integer maxLength, Integer precision, Integer scale, Boolean isUnicode) toUriLiteral(String literal) Converts default literal representation to URI literal representation.booleanvalidate(String value, Boolean isNullable, Integer maxLength, Integer precision, Integer scale, Boolean isUnicode) Validates literal value.final <T> TvalueOfString(String value, Boolean isNullable, Integer maxLength, Integer precision, Integer scale, Boolean isUnicode, Class<T> returnType) Converts literal representation of value to system data type.final StringvalueToString(Object value, Boolean isNullable, Integer maxLength, Integer precision, Integer scale, Boolean isUnicode) Converts system data type to literal representation of value.Methods inherited from class org.apache.olingo.commons.core.edm.primitivetype.SingletonPrimitiveType
equals, getKind, getName, getNamespace, hashCodeMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.olingo.commons.api.edm.EdmPrimitiveType
validateDecimals
-
Field Details
-
dimension
-
type
-
uriPrefix
-
uriSuffix
-
fqn
-
-
Constructor Details
-
AbstractGeospatialType
protected AbstractGeospatialType(Class<T> reference, Geospatial.Dimension dimension, Geospatial.Type type)
-
-
Method Details
-
getDefaultType
Description copied from interface:EdmPrimitiveTypeReturns the default Java type for this EDM primitive type as described in the documentation ofEdmPrimitiveType.- Returns:
- the default Java type
-
stringToPoint
protected Point stringToPoint(String value, Boolean isNullable, Integer maxLength, Integer precision, Integer scale, Boolean isUnicode) throws EdmPrimitiveTypeException - Throws:
EdmPrimitiveTypeException
-
stringToMultiPoint
protected MultiPoint stringToMultiPoint(String value, Boolean isNullable, Integer maxLength, Integer precision, Integer scale, Boolean isUnicode) throws EdmPrimitiveTypeException - Throws:
EdmPrimitiveTypeException
-
stringToLineString
protected LineString stringToLineString(String value, Boolean isNullable, Integer maxLength, Integer precision, Integer scale, Boolean isUnicode) throws EdmPrimitiveTypeException - Throws:
EdmPrimitiveTypeException
-
stringToMultiLineString
protected MultiLineString stringToMultiLineString(String value, Boolean isNullable, Integer maxLength, Integer precision, Integer scale, Boolean isUnicode) throws EdmPrimitiveTypeException - Throws:
EdmPrimitiveTypeException
-
stringToPolygon
protected Polygon stringToPolygon(String value, Boolean isNullable, Integer maxLength, Integer precision, Integer scale, Boolean isUnicode) throws EdmPrimitiveTypeException - Throws:
EdmPrimitiveTypeException
-
stringToMultiPolygon
protected MultiPolygon stringToMultiPolygon(String value, Boolean isNullable, Integer maxLength, Integer precision, Integer scale, Boolean isUnicode) throws EdmPrimitiveTypeException - Throws:
EdmPrimitiveTypeException
-
stringToCollection
protected GeospatialCollection stringToCollection(String value, Boolean isNullable, Integer maxLength, Integer precision, Integer scale, Boolean isUnicode) throws EdmPrimitiveTypeException - Throws:
EdmPrimitiveTypeException
-
toString
protected String toString(Point point, Boolean isNullable, Integer maxLength, Integer precision, Integer scale, Boolean isUnicode) throws EdmPrimitiveTypeException - Throws:
EdmPrimitiveTypeException
-
toString
protected String toString(MultiPoint multiPoint, Boolean isNullable, Integer maxLength, Integer precision, Integer scale, Boolean isUnicode) throws EdmPrimitiveTypeException - Throws:
EdmPrimitiveTypeException
-
toString
protected String toString(LineString lineString, Boolean isNullable, Integer maxLength, Integer precision, Integer scale, Boolean isUnicode) throws EdmPrimitiveTypeException - Throws:
EdmPrimitiveTypeException
-
toString
protected String toString(MultiLineString multiLineString, Boolean isNullable, Integer maxLength, Integer precision, Integer scale, Boolean isUnicode) throws EdmPrimitiveTypeException - Throws:
EdmPrimitiveTypeException
-
toString
protected String toString(Polygon polygon, Boolean isNullable, Integer maxLength, Integer precision, Integer scale, Boolean isUnicode) throws EdmPrimitiveTypeException - Throws:
EdmPrimitiveTypeException
-
toString
protected String toString(MultiPolygon multiPolygon, Boolean isNullable, Integer maxLength, Integer precision, Integer scale, Boolean isUnicode) throws EdmPrimitiveTypeException - Throws:
EdmPrimitiveTypeException
-
toString
protected String toString(GeospatialCollection collection, Boolean isNullable, Integer maxLength, Integer precision, Integer scale, Boolean isUnicode) throws EdmPrimitiveTypeException - Throws:
EdmPrimitiveTypeException
-
getFullQualifiedName
- Specified by:
getFullQualifiedNamein interfaceEdmType- Returns:
- full qualified name
-
isCompatible
Description copied from interface:EdmPrimitiveTypeChecks type compatibility.- Specified by:
isCompatiblein interfaceEdmPrimitiveType- Parameters:
primitiveType- theEdmPrimitiveTypeto be tested for compatibility- Returns:
trueif the provided type is compatible to this type
-
validate
public boolean validate(String value, Boolean isNullable, Integer maxLength, Integer precision, Integer scale, Boolean isUnicode) Description copied from interface:EdmPrimitiveTypeValidates literal value.- Specified by:
validatein interfaceEdmPrimitiveType- Parameters:
value- the literal valueisNullable- whether thenullvalue is allowedmaxLength- the maximum lengthprecision- the precisionscale- the scaleisUnicode- whether non-ASCII characters are allowed (relevant only for Edm.String)- Returns:
trueif the validation is successful
-
valueOfString
public final <T> T valueOfString(String value, Boolean isNullable, Integer maxLength, Integer precision, Integer scale, Boolean isUnicode, Class<T> returnType) throws EdmPrimitiveTypeException Description copied from interface:EdmPrimitiveTypeConverts literal representation of value to system data type.- Specified by:
valueOfStringin interfaceEdmPrimitiveType- Parameters:
value- the literal representation of valueisNullable- whether thenullvalue 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 ofEdmPrimitiveType- Returns:
- the value as an instance of the class the parameter
returnTypeindicates - Throws:
EdmPrimitiveTypeException
-
internalValueOfString
protected abstract <T> T internalValueOfString(String value, Boolean isNullable, Integer maxLength, Integer precision, Integer scale, Boolean isUnicode, Class<T> returnType) throws EdmPrimitiveTypeException - Throws:
EdmPrimitiveTypeException
-
valueToString
public final String valueToString(Object value, Boolean isNullable, Integer maxLength, Integer precision, Integer scale, Boolean isUnicode) throws EdmPrimitiveTypeException Description copied from interface:EdmPrimitiveTypeConverts system data type to literal representation of value.Returns
nullif value isnullandnullis an allowed value.- Specified by:
valueToStringin interfaceEdmPrimitiveType- Parameters:
value- the Java value as Object; its type must be one of the list in the documentation ofEdmPrimitiveTypeisNullable- whether thenullvalue is allowedmaxLength- the maximum lengthprecision- the precisionscale- the scaleisUnicode- whether non-ASCII characters are allowed (relevant only for Edm.String)- Returns:
- literal representation as String
- Throws:
EdmPrimitiveTypeException
-
internalValueToString
protected abstract <T> String internalValueToString(T value, Boolean isNullable, Integer maxLength, Integer precision, Integer scale, Boolean isUnicode) throws EdmPrimitiveTypeException - Throws:
EdmPrimitiveTypeException
-
toUriLiteral
Description copied from interface:EdmPrimitiveTypeConverts default literal representation to URI literal representation.Returns
nullif the literal isnull. Does not perform any validation.- Specified by:
toUriLiteralin interfaceEdmPrimitiveType- Parameters:
literal- the literal in default representation- Returns:
- URI literal representation as String
-
fromUriLiteral
Description copied from interface:EdmPrimitiveTypeConverts URI literal representation to default literal representation.Returns
nullif the literal isnull. Checks the presence of a required prefix and of required surrounding quotation marks but does not perform any further validation.- Specified by:
fromUriLiteralin interfaceEdmPrimitiveType- Parameters:
literal- the literal in URI representation- Returns:
- default literal representation as String
- Throws:
EdmPrimitiveTypeException- if a required prefix or required surrounding quotation marks are missing
-
toString
-