| Constructor: |
public FactoryCreateRule(String className) {
this(className, false);
}
Construct a factory create rule that will use the specified
class name to create an ObjectCreationFactory which will
then be used to create an object and push it on the stack.
Exceptions thrown during the object creation process will be propagated.
Parameters:
className - Java class name of the object creation factory class
|
public FactoryCreateRule(Class clazz) {
this(clazz, false);
}
Construct a factory create rule that will use the specified
class to create an ObjectCreationFactory which will
then be used to create an object and push it on the stack.
Exceptions thrown during the object creation process will be propagated.
Parameters:
clazz - Java class name of the object creation factory class
|
public FactoryCreateRule(ObjectCreationFactory creationFactory) {
this(creationFactory, false);
}
Construct a factory create rule using the given, already instantiated,
ObjectCreationFactory .
Exceptions thrown during the object creation process will be propagated.
Parameters:
creationFactory - called on to create the object.
|
public FactoryCreateRule(Digester digester,
String className) {
this(className);
}
Construct a factory create rule that will use the specified
class name to create an ObjectCreationFactory which will
then be used to create an object and push it on the stack. Parameters:
digester - The associated Digester
className - Java class name of the object creation factory class
|
public FactoryCreateRule(Digester digester,
Class clazz) {
this(clazz);
}
Construct a factory create rule that will use the specified
class to create an ObjectCreationFactory which will
then be used to create an object and push it on the stack. Parameters:
digester - The associated Digester
clazz - Java class name of the object creation factory class
|
public FactoryCreateRule(Digester digester,
ObjectCreationFactory creationFactory) {
this(creationFactory);
}
Parameters:
digester - The associated Digester
creationFactory - called on to create the object.
|
public FactoryCreateRule(String className,
String attributeName) {
this(className, attributeName, false);
}
Construct a factory create rule that will use the specified
class name (possibly overridden by the specified attribute if present)
to create an ObjectCreationFactory , which will then be used
to instantiate an object instance and push it onto the stack.
Exceptions thrown during the object creation process will be propagated.
Parameters:
className - Default Java class name of the factory class
attributeName - Attribute name which, if present, contains an
override of the class name of the object creation factory to create.
|
public FactoryCreateRule(Class clazz,
String attributeName) {
this(clazz, attributeName, false);
}
Construct a factory create rule that will use the specified
class (possibly overridden by the specified attribute if present)
to create an ObjectCreationFactory , which will then be used
to instantiate an object instance and push it onto the stack.
Exceptions thrown during the object creation process will be propagated.
Parameters:
clazz - Default Java class name of the factory class
attributeName - Attribute name which, if present, contains an
override of the class name of the object creation factory to create.
|
public FactoryCreateRule(String className,
boolean ignoreCreateExceptions) {
this(className, null, ignoreCreateExceptions);
}
Construct a factory create rule that will use the specified
class name to create an ObjectCreationFactory which will
then be used to create an object and push it on the stack. Parameters:
className - Java class name of the object creation factory class
ignoreCreateExceptions - if true, exceptions thrown by the object
creation factory
will be ignored.
|
public FactoryCreateRule(Class clazz,
boolean ignoreCreateExceptions) {
this(clazz, null, ignoreCreateExceptions);
}
Construct a factory create rule that will use the specified
class to create an ObjectCreationFactory which will
then be used to create an object and push it on the stack. Parameters:
clazz - Java class name of the object creation factory class
ignoreCreateExceptions - if true, exceptions thrown by the
object creation factory
will be ignored.
|
public FactoryCreateRule(ObjectCreationFactory creationFactory,
boolean ignoreCreateExceptions) {
this.creationFactory = creationFactory;
this.ignoreCreateExceptions = ignoreCreateExceptions;
}
Parameters:
creationFactory - called on to create the object.
ignoreCreateExceptions - if true, exceptions thrown by the object
creation factory will be ignored.
|
public FactoryCreateRule(Digester digester,
String className,
String attributeName) {
this(className, attributeName);
}
Construct a factory create rule that will use the specified
class name (possibly overridden by the specified attribute if present)
to create an ObjectCreationFactory , which will then be used
to instantiate an object instance and push it onto the stack. Parameters:
digester - The associated Digester
className - Default Java class name of the factory class
attributeName - Attribute name which, if present, contains an
override of the class name of the object creation factory to create.
|
public FactoryCreateRule(Digester digester,
Class clazz,
String attributeName) {
this(clazz, attributeName);
}
Construct a factory create rule that will use the specified
class (possibly overridden by the specified attribute if present)
to create an ObjectCreationFactory , which will then be used
to instantiate an object instance and push it onto the stack. Parameters:
digester - The associated Digester
clazz - Default Java class name of the factory class
attributeName - Attribute name which, if present, contains an
override of the class name of the object creation factory to create.
|
public FactoryCreateRule(String className,
String attributeName,
boolean ignoreCreateExceptions) {
this.className = className;
this.attributeName = attributeName;
this.ignoreCreateExceptions = ignoreCreateExceptions;
}
Construct a factory create rule that will use the specified
class name (possibly overridden by the specified attribute if present)
to create an ObjectCreationFactory , which will then be used
to instantiate an object instance and push it onto the stack. Parameters:
className - Default Java class name of the factory class
attributeName - Attribute name which, if present, contains an
override of the class name of the object creation factory to create.
ignoreCreateExceptions - if true, exceptions thrown by the object
creation factory will be ignored.
|
public FactoryCreateRule(Class clazz,
String attributeName,
boolean ignoreCreateExceptions) {
this(clazz.getName(), attributeName, ignoreCreateExceptions);
}
Construct a factory create rule that will use the specified
class (possibly overridden by the specified attribute if present)
to create an ObjectCreationFactory , which will then be used
to instantiate an object instance and push it onto the stack. Parameters:
clazz - Default Java class name of the factory class
attributeName - Attribute name which, if present, contains an
override of the class name of the object creation factory to create.
ignoreCreateExceptions - if true, exceptions thrown by the object
creation factory will be ignored.
|
| Method from org.apache.commons.digester.FactoryCreateRule Detail: |
public void begin(String namespace,
String name,
Attributes attributes) throws Exception {
// --------------------------------------------------------- Public Methods
if (ignoreCreateExceptions) {
if (exceptionIgnoredStack == null) {
exceptionIgnoredStack = new ArrayStack();
}
try {
Object instance = getFactory(attributes).createObject(attributes);
if (digester.log.isDebugEnabled()) {
digester.log.debug("[FactoryCreateRule]{" + digester.match +
"} New " + instance.getClass().getName());
}
digester.push(instance);
exceptionIgnoredStack.push(Boolean.FALSE);
} catch (Exception e) {
// log message and error
if (digester.log.isInfoEnabled()) {
digester.log.info("[FactoryCreateRule] Create exception ignored: " +
((e.getMessage() == null) ? e.getClass().getName() : e.getMessage()));
if (digester.log.isDebugEnabled()) {
digester.log.debug("[FactoryCreateRule] Ignored exception:", e);
}
}
exceptionIgnoredStack.push(Boolean.TRUE);
}
} else {
Object instance = getFactory(attributes).createObject(attributes);
if (digester.log.isDebugEnabled()) {
digester.log.debug("[FactoryCreateRule]{" + digester.match +
"} New " + instance.getClass().getName());
}
digester.push(instance);
}
}
Process the beginning of this element. |
public void end(String namespace,
String name) throws Exception {
// check if object was created
// this only happens if an exception was thrown and we're ignoring them
if (
ignoreCreateExceptions &&
exceptionIgnoredStack != null &&
!(exceptionIgnoredStack.empty())) {
if (((Boolean) exceptionIgnoredStack.pop()).booleanValue()) {
// creation exception was ignored
// nothing was put onto the stack
if (digester.log.isTraceEnabled()) {
digester.log.trace("[FactoryCreateRule] No creation so no push so no pop");
}
return;
}
}
Object top = digester.pop();
if (digester.log.isDebugEnabled()) {
digester.log.debug("[FactoryCreateRule]{" + digester.match +
"} Pop " + top.getClass().getName());
}
}
Process the end of this element. |
public void finish() throws Exception {
if (attributeName != null) {
creationFactory = null;
}
}
Clean up after parsing is complete. |
protected ObjectCreationFactory getFactory(Attributes attributes) throws Exception {
if (creationFactory == null) {
String realClassName = className;
if (attributeName != null) {
String value = attributes.getValue(attributeName);
if (value != null) {
realClassName = value;
}
}
if (digester.log.isDebugEnabled()) {
digester.log.debug("[FactoryCreateRule]{" + digester.match +
"} New factory " + realClassName);
}
Class clazz = digester.getClassLoader().loadClass(realClassName);
creationFactory = (ObjectCreationFactory)
clazz.newInstance();
creationFactory.setDigester(digester);
}
return (creationFactory);
}
Return an instance of our associated object creation factory,
creating one if necessary. |
public String toString() {
StringBuffer sb = new StringBuffer("FactoryCreateRule[");
sb.append("className=");
sb.append(className);
sb.append(", attributeName=");
sb.append(attributeName);
if (creationFactory != null) {
sb.append(", creationFactory=");
sb.append(creationFactory);
}
sb.append("]");
return (sb.toString());
}
Render a printable version of this Rule. |