flexjson.factories.ClassLocatorObjectFactory Maven / Gradle / Ivy
package flexjson.factories;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.util.Collection;
import java.util.Map;
import flexjson.ClassLocator;
import flexjson.JSONException;
import flexjson.ObjectBinder;
import flexjson.ObjectFactory;
public class ClassLocatorObjectFactory implements ObjectFactory
{
private ClassLocator locator;
public ClassLocatorObjectFactory(ClassLocator locator)
{
this.locator= locator;
}
public Object instantiate(ObjectBinder context, Object value, Type targetType, Class targetClass)
{
Class clazz= null;
try
{
clazz= locator.locate(context, context.getCurrentPath());
if (clazz != null)
{
if (Collection.class.isAssignableFrom(clazz))
{
return context.bindIntoCollection((Collection) value, (Collection
© 2015 - 2025 Weber Informatics LLC | Privacy Policy