Class JPATypeConvertor

java.lang.Object
com.sap.olingo.jpa.metadata.core.edm.mapper.impl.JPATypeConvertor

public final class JPATypeConvertor extends Object
This class holds utility methods for type conversions between JPA Java types and OData Types.
  • 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 ODataJPAModelException
      This 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:
      ODataJPAModelException
      org.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

      public static boolean isScalarType(Class<?> type)
    • isSupportedByOlingo

      public static boolean isSupportedByOlingo(Class<?> type)
      For supported java types see EdmPrimitiveType. 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: