Class ErpTypeSerializer
java.lang.Object
com.sap.cloud.sdk.s4hana.connectivity.ErpTypeSerializer
Deprecated.
This module will be discontinued, along with its classes and methods.
Used for serialization and deserialization of ERP-based types.
-
Constructor Summary
ConstructorsConstructorDescriptionDeprecated.Initializes theErpTypeSerializer
with default ERP type converters. -
Method Summary
Modifier and TypeMethodDescription<T> ConvertedObject<T>
Deprecated.Convert a given String based erpObject in the ERP-based representation into an object of resultType.Deprecated.Gets registeredErpTypeConverter
s.Map<Class<?>,
ErpTypeConverter<?>> Deprecated.Gets registeredErpTypeConverter
s for eachErpType
.<T> ConvertedObject<String>
toErp
(T object) Deprecated.Convert given object to an ERP type using a registeredErpTypeConverter
.withTypeConverters
(ErpTypeConverter<?>... typeConverters) Deprecated.Delegates towithTypeConverters(Iterable)
.withTypeConverters
(Iterable<ErpTypeConverter<?>> typeConverters) Deprecated.Registers the givenErpTypeConverter
s.
-
Constructor Details
-
ErpTypeSerializer
public ErpTypeSerializer()Deprecated.Initializes theErpTypeSerializer
with default ERP type converters.
-
-
Method Details
-
withTypeConverters
@Nonnull public ErpTypeSerializer withTypeConverters(@Nonnull Iterable<ErpTypeConverter<?>> typeConverters) Deprecated.Registers the givenErpTypeConverter
s. Replaces existing converters for already existing types that have been added before.- Parameters:
typeConverters
- The ERP type converters to be added.- Returns:
- The same instance.
-
withTypeConverters
@Nonnull public ErpTypeSerializer withTypeConverters(@Nonnull ErpTypeConverter<?>... typeConverters) Deprecated.Delegates towithTypeConverters(Iterable)
.- Parameters:
typeConverters
- The ERP type converters to be added.- Returns:
- The same instance.
-
getTypeConverters
Deprecated.Gets registeredErpTypeConverter
s.- Returns:
- All registered ERP type converters.
-
getTypeConvertersByType
Deprecated.Gets registeredErpTypeConverter
s for eachErpType
.- Returns:
- The converters for each ERP type.
-
toErp
Deprecated.Convert given object to an ERP type using a registeredErpTypeConverter
.Example usage in the SDK
ErpTypeSerializer
test:final ErpTypeSerializer serializer = new ErpTypeSerializer(); assertThat(serializer.toErp(new CostCenter("123")).get()).isEqualTo("0000000123"); assertThat(serializer.toErp(-123.4d).get()).isEqualTo("123.4-");
- Type Parameters:
T
- The generic type.- Parameters:
object
- The ERP object to serialize.- Returns:
- A wrapped instance of the serialized object.
-
fromErp
@Nonnull public <T> ConvertedObject<T> fromErp(@Nullable String erpObject, @Nonnull Class<T> resultType) Deprecated.Convert a given String based erpObject in the ERP-based representation into an object of resultType. For the conversion, uses aErpTypeConverter
registered for resultType.* Example usage in the SDK
ErpTypeSerializer
test:assertThat(serializer.fromErp("0000000123", CostCenter.class).get()).isEqualTo(new CostCenter("123")); assertThat(serializer.fromErp("123.4 ", Double.class).get()).isEqualTo(123.4d); assertThat(serializer.fromErp("123.4-", Double.class).get()).isEqualTo(-123.4d);
- Type Parameters:
T
- The generic result type.- Parameters:
erpObject
- The serialized ERP object.resultType
- The expected deserialization result type.- Returns:
- A wrapped instance of the deserialized object.
-