Type - the type of object to convert to.public abstract class AbstractConverter<Type> extends Object implements ParamAwareConverter<Type>
ParamAwareConverter interface that can be used by the user to define their custom
converters. Users are encouraged to extend this class instead of implementing either Converter or ParamAwareConverterinterface
directly as this class provides the common implementations of convertTo() , instanceOfType() and convert(Map, String)
methods whose implementations are generic to every Converter.
For an example of a custom converter, you can look at the following :
https://github.com/EaseTech/easytest-core/blob/master/src/test/java/org/easetech/easytest/example/ItemConverter.javaCOLON, EMPTY_STRING| Constructor and Description |
|---|
AbstractConverter() |
| Modifier and Type | Method and Description |
|---|---|
Type |
convert(Map<String,Object> convertFrom,
String paramName)
Convert the Map into a user defined object and also expect the param name
|
Class<Type> |
convertTo()
Get the Class variable representing the Type object
|
ConverterSupport |
getConverterSupport()
Get the converter support instance
|
String |
getParamName()
Deprecated.
|
Type |
instanceOfType()
Method responsible for returning an instance of the provided Generic Type argument.
|
void |
setConverterSupport(ConverterSupport converterSupport)
Set the converter support instance
|
void |
setParamName(String paramName)
Deprecated.
|
public Type convert(Map<String,Object> convertFrom, String paramName)
ParamAwareConverterconvert in interface ParamAwareConverter<Type>convertFrom - the Map to convert fromparamName - the name of the parameter for which this converter is calledConverter.convertTo() class.public Type instanceOfType()
Class.newInstance() method to return the instance. If the passed generic type argument is an interface or
an abstract type, then the method calls the Assert.fail() telling the user that the passed Class object
was not a Concrete class.
instanceOfType in interface Converter<Type>AbstractConverter@Deprecated public String getParamName()
@Deprecated public void setParamName(String paramName)
public ConverterSupport getConverterSupport()
public void setConverterSupport(ConverterSupport converterSupport)
converterSupport - the converterSupport to setCopyright © 2014. All rights reserved.