Class PrimitiveBasedObjectExtractor<T>

java.lang.Object
com.sap.cloud.sdk.result.PrimitiveBasedObjectExtractor<T>
Type Parameters:
T - class type of target object for extraction (deserialization)
All Implemented Interfaces:
ObjectExtractor<T>

public class PrimitiveBasedObjectExtractor<T> extends Object implements ObjectExtractor<T>
This class implements the basic ObjectExtractor interface, offering a method to create an object by extracting arbitrary input data of type ResultElement. The created object will be of the same target type as declared in the PrimitiveBasedObjectExtractor class constructor. The target type will be dynamically checked for parametrized constructors which fit the given input data. A fitting constructor will be used for object creation.

This implementation will only support extraction of ResultPrimitive.

Constructors with primitive parameters are prioritized.

  • Constructor Details

    • PrimitiveBasedObjectExtractor

      public PrimitiveBasedObjectExtractor(Class<T> objectType)
  • Method Details

    • extract

      @Nonnull public T extract(@Nonnull ResultElement resultElement)
      Description copied from interface: ObjectExtractor
      Extracts the value of the given ResultElement as the type T.
      Specified by:
      extract in interface ObjectExtractor<T>
      Parameters:
      resultElement - The ResultElement to transform.
      Returns:
      The resultElement as the given type.