Skip to content

4. Convert API

iamankit1995 edited this page May 2, 2019 · 1 revision

Converts any object from 2.5 to 3.0 or vice versa. This conversion not only covers the root level objects like converting OpenRtb.class to BidRequest.class but can also convert any internal object as well. Eg. Item.class object to Imp.class object.

S.no Parameters Purpose Is mandatory Data Type Example
1 Source Class Source class type TRUE Class BidResponse2_X.class
2 Target Class Target class type TRUE Class OpenRTBWrapper3_X.class
3 Source Source class instance which needs to be converted to target class. TRUE Source Type NA
5 Overriding config - Config object to override the fields of the global config object supplied at time of OpenRtbConverter object creation for this particular request False (by default global config is picked) Config NA
6 Overriding converter map Overriding the converter implementation of library for some objects. False (by default global config is picked) Map<Conversion, Converter> NA

** Overloaded functions**

public  <U, V> V convert(Config overridingConfig, U source, Class<U> sourceClass, Class<V> targetClass) throws ConfigurationException, OpenRtbConverterException;
public  <U, V> V convert(Config overridingConfig, U source, Class<U> sourceClass, Class<V>
targetClass, Map<Conversion, Converter> overridingMap) throws ConfigurationException,
OpenRtbConverterException;
public  <U, V> V convert(U source, Class<U> sourceClass, Class<V>
targetClass, Map<Conversion, Converter> overridingMap) throws ConfigurationException,
OpenRtbConverterException;
public <U, V> V convert(U source, Class<U> sourceClass, Class<V> targetClass) throws
 ConfigurationException, OpenRtbConverterException;
public <U, V> String convert(String source, Class<U> sourceClass, Class<V> targetClass) throws
 ConfigurationException, OpenRtbConverterException; // Stringified Json as source and target in conversion