Class JPATypeConvertor
java.lang.Object
com.sap.olingo.jpa.metadata.core.edm.mapper.impl.JPATypeConvertor
This class holds utility methods for type conversions between JPA Java types and OData Types.
-
Method Summary
Modifier and TypeMethodDescriptionstatic org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKindconvertToEdmSimpleType(JPAAttribute attribute)static org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKindconvertToEdmSimpleType(Class<?> type)static <T> org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKindconvertToEdmSimpleType(Class<T> jpaType, javax.persistence.metamodel.Attribute<?,?> currentAttribute)This utility method converts a given jpa Type to equivalent EdmPrimitiveTypeKind for maintaining compatibility between Java and OData Types.static booleanisScalarType(Class<?> type)static booleanisSimpleType(Class<?> type, javax.persistence.metamodel.Attribute<?,?> currentAttribute)static booleanisSupportedByOlingo(Class<?> type)For supported java types seeEdmPrimitiveType.
-
Method Details
-
convertToEdmSimpleType
public static org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind convertToEdmSimpleType(Class<?> type) throws ODataJPAModelException- Throws:
ODataJPAModelException
-
convertToEdmSimpleType
public static <T> org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind convertToEdmSimpleType(Class<T> jpaType, javax.persistence.metamodel.Attribute<?,?> currentAttribute) throws ODataJPAModelExceptionThis utility method converts a given jpa Type to equivalent EdmPrimitiveTypeKind for maintaining compatibility between Java and OData Types.- Parameters:
jpaType- The JPA Type input.- Returns:
- The corresponding EdmPrimitiveTypeKind.
- Throws:
ODataJPAModelExceptionorg.apache.olingo.odata2.jpa.processor.api.exception.ODataJPARuntimeException- See Also:
EdmPrimitiveTypeKind
-
convertToEdmSimpleType
public static org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind convertToEdmSimpleType(JPAAttribute attribute) throws ODataJPAModelException- Throws:
ODataJPAModelException
-
isSimpleType
public static boolean isSimpleType(Class<?> type, javax.persistence.metamodel.Attribute<?,?> currentAttribute) -
isScalarType
-
isSupportedByOlingo
For supported java types seeEdmPrimitiveType. In addition, since 4.7.1, also some types from the java.time package are supported, see:- For EdmDate: LocalDate, see
EdmDate.internalValueToString - For EdmTimeOfDay: LocalTime, see
EdmTimeOfDay.internalValueToString - For EdmDateTimeOffset: ZonedDateTime, see
EdmDateTimeOffset.internalValueToString
- Parameters:
type-- Returns:
- For EdmDate: LocalDate, see
-