Class ODataTypeUtils
java.lang.Object
com.sap.cds.services.impl.odata.utils.ODataTypeUtils
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic com.sap.cds.reflect.CdsBaseTypegetCdsType(com.sap.cds.reflect.CdsStructuredType structuredType, com.sap.cds.ql.cqn.CqnElementRef ref) This method determines the CDS type of the referencerefbelonging to thestructuredTypestatic booleanisArrayedSimpleType(com.sap.cds.reflect.CdsType type) static booleanisArrayedStructuredType(com.sap.cds.reflect.CdsType type) static booleanisSimpleType(com.sap.cds.reflect.CdsType type) static booleanisStructuredType(com.sap.cds.reflect.CdsType type) static ObjectThis method converts thevalueto the correct Java type defined intype.static Iterable<?>toCdsTypes(com.sap.cds.reflect.CdsBaseType type, Iterable<? extends Object> data) toCdsTypes(com.sap.cds.reflect.CdsStructuredType structuredType, T data) static ObjecttoCloudSdkType(Object value, com.sap.cds.reflect.CdsBaseType type, com.sap.cloud.sdk.datamodel.odata.client.ODataProtocol protocol) Converts theObjectto the correct Java type to be used with Cloud SDK.
-
Field Details
-
FACTOR_MILLIS_TO_DAYS
public static final long FACTOR_MILLIS_TO_DAYS- See Also:
-
-
Constructor Details
-
ODataTypeUtils
public ODataTypeUtils()
-
-
Method Details
-
toCloudSdkType
public static Object toCloudSdkType(Object value, com.sap.cds.reflect.CdsBaseType type, com.sap.cloud.sdk.datamodel.odata.client.ODataProtocol protocol) Converts theObjectto the correct Java type to be used with Cloud SDK.- Parameters:
value- the value to converttype- theCdsBaseTypeprotocol- theODataProtocol- Returns:
- the
valueconverted to the correct type
-
getCdsType
public static com.sap.cds.reflect.CdsBaseType getCdsType(com.sap.cds.reflect.CdsStructuredType structuredType, com.sap.cds.ql.cqn.CqnElementRef ref) This method determines the CDS type of the referencerefbelonging to thestructuredType- Parameters:
structuredType- theCdsStructuredTyperef- theCqnElementRef- Returns:
- the CDS type if it could be determined
-
toCdsTypes
-
toCdsTypes
public static <T extends Iterable<? extends Map<String,Object>>> T toCdsTypes(com.sap.cds.reflect.CdsStructuredType structuredType, T data) Converts the values indatato the correct Java types according to the respectiveCdsBaseTypedefined in the CDS model.- Type Parameters:
T- the data type- Parameters:
structuredType- theCdsStructuredTypedata- the data to convert- Returns:
- The converted data
-
toCdsTypes
-
toCdsType
This method converts thevalueto the correct Java type defined intype.- Parameters:
value- the value to converttype- theCdsBaseTypeto convert to- Returns:
- the converted value
- Throws:
ErrorStatusException- in case the value cannot be converted
-
isSimpleType
public static boolean isSimpleType(com.sap.cds.reflect.CdsType type) -
isArrayedSimpleType
public static boolean isArrayedSimpleType(com.sap.cds.reflect.CdsType type) -
isStructuredType
public static boolean isStructuredType(com.sap.cds.reflect.CdsType type) -
isArrayedStructuredType
public static boolean isArrayedStructuredType(com.sap.cds.reflect.CdsType type)
-