public class PeerFactory
extends java.lang.Object
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 and Description |
|---|
PeerFactory(java.lang.String resourceName,
java.lang.ClassLoader classLoader)
Creates a new
PeerFactory. |
| Modifier and Type | Method and Description |
|---|---|
java.lang.Object |
getPeerForObject(java.lang.Class objectClass,
boolean searchSuperClasses)
Retrieves the appropriate peer instance for a given object
Class. |
public PeerFactory(java.lang.String resourceName,
java.lang.ClassLoader classLoader)
PeerFactory.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 instancespublic java.lang.Object getPeerForObject(java.lang.Class objectClass,
boolean searchSuperClasses)
Class. Returns null in the event that no peer is provided
to support the specified class.objectClass - the supported object classsearchSuperClasses - flag indicating whether superclasses
of objectClass should be searched for peers if
none can be found for objectClass itself