NextApp Echo3
v3.0.b4

nextapp.echo.app.util
Class PeerFactory

java.lang.Object
  extended by nextapp.echo.app.util.PeerFactory

public class PeerFactory
extends java.lang.Object

A mechanism for retrieving instances of singleton peer objects which are defined to each support a specific Class. A properties file is used to associate peer classes with their supported classes. The properties file should contain the fully qualified class names of the supported objects as its keys. The values of the properties file should contain the fully qualified class names of the peer objects. A single instance of each peer class will be used to support ALL instances of the supported class.


Constructor Summary
PeerFactory(java.lang.String resourceName, java.lang.ClassLoader classLoader)
          Creates a new PeerFactory.
 
Method Summary
 java.lang.Object getPeerForObject(java.lang.Class objectClass, boolean searchSuperClasses)
          Retrieves the appropriate peer instance for a given object Class.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PeerFactory

public PeerFactory(java.lang.String resourceName,
                   java.lang.ClassLoader classLoader)
Creates a new PeerFactory.

Parameters:
resourceName - the name of the resource properties file from which the peer bindings may be retrieved (this file will be retrieved using the PropertiesDiscovery system, so multiple instances of the file within the CLASSPATH will be automatically discovered.
classLoader - the ClassLoader to use for retrieving the resource file and for instantiating the peer singleton instances
Method Detail

getPeerForObject

public java.lang.Object getPeerForObject(java.lang.Class objectClass,
                                         boolean searchSuperClasses)
Retrieves the appropriate peer instance for a given object Class. Returns null in the event that no peer is provided to support the specified class.

Parameters:
objectClass - the supported object class
searchSuperClasses - flag indicating whether superclasses of objectClass should be searched for peers if none can be found for objectClass itself
Returns:
the relevant peer, or null if none can be found

NextApp Echo3
v3.0.b4