Oracle Corporation

com.bea.wlcp.wlng.api.util
Class InstanceFactory

java.lang.Object
  extended bycom.bea.wlcp.wlng.api.util.InstanceFactory

public final class InstanceFactory
extends Object

Common factory used to retrieve instances of for a given interface, class or abstract class. The implementation will be located based on these rules: 1. Find a mapping from the provided interface/class to the implementation. Mappings are configured in a file called "instancemap". Every jar in the WLNG can have it's own mapping file, which is a standard java.util.Properties file. To override the default mapping defined in the instancemap files include a file called instancemap.override where new mappings are defined. 2. Instantiate theClass if it has a public constructor or static singleton method. 3. Instantiate theClass+"Impl" if it exists and has a public constructor or static singleton method. Example instancemap file: com.bea.wlcp.wlng.MyInterface=com.bea.wlcp.wlng.MyImplementation com.bea.wlcp.wlng.MyOtherInterface=com.bea.wlcp.wlng.MyOtherImplementation

Copyright © 2008 Oracle Corporation Systems, Inc. All Rights Reserved.

Method Summary
 Object getImplementation(Class theClass)
          Retrieves a class that implements/extends a given interface/class.
static InstanceFactory getInstance()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getImplementation

public Object getImplementation(Class theClass)
                         throws NoClassDefFoundError,
                                InvocationTargetException
Retrieves a class that implements/extends a given interface/class.

Parameters:
theClass - The interface/class that the returned object should implement.
Returns:
The implementation.
Throws:
NoClassDefFoundError - If no implementation is available.
InvocationTargetException - If there is an exception cast from the implementation. The cause will contain the actual exception.

getInstance

public static InstanceFactory getInstance()

Oracle Corporation