org.jpu.patterns.factory
Class FactoryOptions

java.lang.Object
  extended byorg.jpu.patterns.factory.FactoryOptions
All Implemented Interfaces:
java.lang.Cloneable

public class FactoryOptions
extends java.lang.Object
implements java.lang.Cloneable

Used by clients of IPrototypeFactory to pass options adjusting its behavior.


Field Summary
 boolean copy
           
 boolean throwExc
           
 java.lang.Object[] userdata
           
 
Constructor Summary
FactoryOptions()
           
 
Method Summary
 java.lang.Object clone()
           
static FactoryOptions defaultIfNull(FactoryOptions o)
           
 boolean getCopy()
           
 boolean getThrowExc()
          Returns the 'throwExc' attribute.
 java.lang.Object[] getUserData()
          Returns the 'userData' attribute.
static FactoryOptions makeNew(FactoryOptions o)
           
 FactoryOptions setCopy(boolean b)
           
 FactoryOptions setThrowExc(boolean b)
          Sets the 'throwExc' attribute to the given value.
 FactoryOptions setUserData(java.lang.Object[] m)
          Sets the 'userData' attribute to the given value.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

copy

public boolean copy

throwExc

public boolean throwExc

userdata

public java.lang.Object[] userdata
Constructor Detail

FactoryOptions

public FactoryOptions()
Method Detail

clone

public java.lang.Object clone()

makeNew

public static FactoryOptions makeNew(FactoryOptions o)

defaultIfNull

public static FactoryOptions defaultIfNull(FactoryOptions o)

setCopy

public FactoryOptions setCopy(boolean b)

getCopy

public boolean getCopy()

setThrowExc

public FactoryOptions setThrowExc(boolean b)
Sets the 'throwExc' attribute to the given value. This attribute specifies whether or not a NoSuchPrototypeException should be thrown if a prototype is requested by a key under which no prototype has been registered. If this attribute is false, the method called to request the object will return null instead of throwing an exception.

'throwExc' is true by default.


getThrowExc

public boolean getThrowExc()
Returns the 'throwExc' attribute. See setThrowExc(boolean).


setUserData

public FactoryOptions setUserData(java.lang.Object[] m)
Sets the 'userData' attribute to the given value. User data is an array of Object's used to parameterize instantiations done by the factory. These parameters are ignored by the classes in org.jpu.patterns.factory but may be referenced either by strategies registered with the factory by clients, or by subclasses that override method accepting a FactoryOptions parameter.

Typically, 'userData' would be used in conjunction with IPrototypeFactory.IInstantiator's for prototype classes whose constructors require one or more parameters.

'userData' is null by default.


getUserData

public java.lang.Object[] getUserData()
Returns the 'userData' attribute. See setUserData(java.lang.Object[]).


toString

public java.lang.String toString()


Copyright (c) 2001-2003 - Apache Software Foundation