javax.naming.spi

Interface ObjectFactory

public interface ObjectFactory

Represents a factory for creating the object. ObjectFactory performs the operation, that is the opposite to the operation, performed by the {@link StateFactory}. Classes, implementing this interface, must be public and have public parameterless constructor.
Method Summary
ObjectgetObjectInstance(Object refObj, Name name, Context nameCtx, Hashtable<?,?> environment)
Creates the object, using the specified name and location information.

Method Detail

getObjectInstance

public Object getObjectInstance(Object refObj, Name name, Context nameCtx, Hashtable<?,?> environment)
Creates the object, using the specified name and location information. The call of this method must be thread safe.

Parameters: refObj may provide the reference and location information. Can be null. name the name of the new object in the scope of the specified naming context. Can be null if the name is not specified. nameCtx the context, in which the object name is specified. Can be null if the name is specified in the scope of the default initial context. environment the properties, providing additional information on how to create an object. Can be null if not additional information is provided.

Returns: the newly created object or null if the object cannot be created

Throws: Exception if this factory suggest not to try creating of this object by other alternative factories

See Also: NamingManager