|
NextApp Echo App Container 1.1.4 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object nextapp.echoservlet.util.PeerFactory
Generates "peer" objects for objects based on associations. Associations are stored in a properties files, where the keys are the fully qualified class names of objects and the values are the fully qualified class names of their peers. When an object is passed to the createPeer() method its peer will be returned based on the bindings in the properties file. An objects superclass(es) will also be tested for available peers if none is available for the derived class. If no peer is found, a PeerFactoryException is thrown.
Nested Class Summary | |
class |
PeerFactory.PeerFactoryException
An exception used to describe a problem that was encountered loading a peer object. |
Constructor Summary | |
PeerFactory()
Creates a new PeerFactory . |
|
PeerFactory(java.lang.String propertiesFile)
Creates a new PeerFactory with initial associations. |
Method Summary | |
void |
addAssociation(java.lang.String className,
java.lang.String peerClassName)
Adds a single peer binding. |
void |
addAssociations(java.lang.String propertiesFile)
Loads peer bindings. |
java.lang.Object |
createPeer(java.lang.Object object)
Instantiates a new peer for the specified object by invoking its default constructor. |
java.lang.Class |
getPeerClass(java.lang.Class objectClass)
Returns the peer class associated for the given object class. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public PeerFactory()
PeerFactory
.
public PeerFactory(java.lang.String propertiesFile) throws PeerFactory.PeerFactoryException
PeerFactory
with initial associations.
propertiesFile
- The name for the properties file containing the
initial peer bindings.Method Detail |
public void addAssociation(java.lang.String className, java.lang.String peerClassName)
className
- The fully qualified name of the class.peerClassName
- The fully qualified name of the peer class.public void addAssociations(java.lang.String propertiesFile) throws PeerFactory.PeerFactoryException
propertiesFile
- The name of a properties file containing the peer
bindings to be loaded.
PeerFactory.PeerFactoryException
public java.lang.Object createPeer(java.lang.Object object) throws PeerFactory.PeerFactoryException
object
- The object for which to create an peer instance.
object
.
PeerFactory.PeerFactoryException
- if the peer cannot be instantiated.public java.lang.Class getPeerClass(java.lang.Class objectClass) throws PeerFactory.PeerFactoryException
objectClass
- The Class
of the object whose peer
Class
is to be determined.
Class
of the corresponding peer.
PeerFactory.PeerFactoryException
- if the peer class cannot be determined.
|
NextApp Echo App Container 1.1.4 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |