Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
package jadex.transformation.jsonserializer.processors;
import java.lang.reflect.Type;
import java.util.List;
import jadex.common.transformation.IStringConverter;
import jadex.common.transformation.traverser.ITraverseProcessor;
import jadex.common.transformation.traverser.Traverser;
import jadex.common.transformation.traverser.Traverser.MODE;
/**
*
*/
public abstract class AbstractJsonProcessor implements ITraverseProcessor
{
/**
* Test if the processor is applicable for reading.
* @param object The object.
* @param targetcl If not null, the traverser should make sure that the result object is compatible with the class loader,
* e.g. by cloning the object using the class loaded from the target class loader.
* @return True, if is applicable.
*/
protected abstract boolean isApplicable(Object object, Type type, ClassLoader targetcl, JsonReadContext context);
/**
* Test if the processor is applicable for writing.
* @param object The object.
* @param targetcl If not null, the traverser should make sure that the result object is compatible with the class loader,
* e.g. by cloning the object using the class loaded from the target class loader.
* @return True, if is applicable.
*/
protected abstract boolean isApplicable(Object object, Type type, ClassLoader targetcl, JsonWriteContext context);
/**
* Read an object.
* @param object The object.
* @param targetcl If not null, the traverser should make sure that the result object is compatible with the class loader,
* e.g. by cloning the object using the class loaded from the target class loader.
* @return The processed object.
*/
protected abstract Object readObject(Object object, Type type, Traverser traverser, List conversionprocessors, List processors, IStringConverter converter, MODE mode, ClassLoader targetcl, JsonReadContext context);
/**
* Write an object.
* @param object The object.
* @param targetcl If not null, the traverser should make sure that the result object is compatible with the class loader,
* e.g. by cloning the object using the class loaded from the target class loader.
* @return The processed object.
*/
protected abstract Object writeObject(Object object, Type type, Traverser traverser, List conversionprocessors, List processors, IStringConverter converter, MODE mode, ClassLoader targetcl, JsonWriteContext context);
/**
* Test if the processor is applicable.
* @param object The object.
* @param targetcl If not null, the traverser should make sure that the result object is compatible with the class loader,
* e.g. by cloning the object using the class loaded from the target class loader.
* @return True, if is applicable.
*/
public final boolean isApplicable(Object object, Type type, ClassLoader targetcl, Object context)
{
if (context instanceof JsonReadContext)
return isApplicable(object, type, targetcl, (JsonReadContext) context);
else
return isApplicable(object, type, targetcl, (JsonWriteContext) context);
}
/**
* Process an object.
* @param object The object.
* @param targetcl If not null, the traverser should make sure that the result object is compatible with the class loader,
* e.g. by cloning the object using the class loaded from the target class loader.
* @return The processed object.
*/
public final Object process(Object object, Type type, Traverser traverser, List conversionprocessors, List processors, IStringConverter converter, MODE mode, ClassLoader targetcl, Object context)
{
if (context instanceof JsonReadContext)
return readObject(object, type, traverser, conversionprocessors, processors, converter, mode, targetcl, (JsonReadContext) context);
else
return writeObject(object, type, traverser, conversionprocessors, processors, converter, mode, targetcl, (JsonWriteContext) context);
}
}