ObjectFactory.java :  » JSON » svenson » org » svenson » Java Open Source

Java Open Source » JSON » svenson 
svenson » org » svenson » ObjectFactory.java
package org.svenson;

/**
 * Factory that can create user objects with special dependencies from within svenson.
 * 
 * @see JSONParser#addObjectFactory(ObjectFactory)
 * 
 * @author fforw at gmx dot de
 * 
 * @param <T> Base type of types to create
 */
public interface ObjectFactory<T>
{
    /**
     * Returns <code>true</code> if the factory can create objects of the given class
     * 
     * @param cls
     * @return
     */
    boolean supports(Class<T> cls);
    
    /**
     * Creates an instance of the given type.
     * @param typeHint
     * @return
     */
    T create(Class<T> typeHint);
}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.