Open Source Repository

Home /json/flexjson-2.1 | Repository Home



flexjson/factories/ListObjectFactory.java
package flexjson.factories;

import flexjson.ObjectBinder;
import flexjson.ObjectFactory;

import java.util.Collection;
import java.util.ArrayList;
import java.lang.reflect.Type;

public class ListObjectFactory implements ObjectFactory {
    public Object instantiate(ObjectBinder context, Object value, Type targetType, Class targetClass) {
        ifvalue instanceof Collection) {
            return context.bindIntoCollection((Collection)value, new ArrayList(), targetType);
        else {
            ArrayList<Object> set = new ArrayList<Object>();
            set.addcontext.bindvalue ) );
            return set;
        }
    }
}