Class FactoryCreateBuilder
- java.lang.Object
-
- org.apache.commons.digester3.binder.AbstractBackToLinkedRuleBuilder<FactoryCreateRule>
-
- org.apache.commons.digester3.binder.FactoryCreateBuilder
-
- All Implemented Interfaces:
RuleProvider<FactoryCreateRule>
public final class FactoryCreateBuilder extends AbstractBackToLinkedRuleBuilder<FactoryCreateRule>
Builder chained when invokingLinkedRuleBuilder.factoryCreate()
.- Since:
- 3.0
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.String
attributeName
private java.lang.ClassLoader
classLoader
private ObjectCreationFactory<?>
creationFactory
private boolean
ignoreCreateExceptions
private java.lang.Class<? extends ObjectCreationFactory<?>>
type
-
Constructor Summary
Constructors Constructor Description FactoryCreateBuilder(java.lang.String keyPattern, java.lang.String namespaceURI, RulesBinder mainBinder, LinkedRuleBuilder mainBuilder, java.lang.ClassLoader classLoader)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected FactoryCreateRule
createRule()
Provides an instance ofRule
.FactoryCreateBuilder
ignoreCreateExceptions(boolean ignoreCreateExceptions)
Exceptions thrown by the object creation factory will be ignored or not.FactoryCreateBuilder
ofType(java.lang.Class<? extends ObjectCreationFactory<?>> type)
Construct a factory create rule that will use the specified class to create anObjectCreationFactory
which will then be used to create an object and push it on the stack.FactoryCreateBuilder
ofType(java.lang.String className)
Construct a factory create rule that will use the specified class name to create anObjectCreationFactory
which will then be used to create an object and push it on the stack.FactoryCreateBuilder
overriddenByAttribute(java.lang.String attributeName)
Allows specify the attribute containing an override class name if it is present.<T> FactoryCreateBuilder
usingFactory(ObjectCreationFactory<T> creationFactory)
Construct a factory create rule using the given, already instantiated,ObjectCreationFactory
.-
Methods inherited from class org.apache.commons.digester3.binder.AbstractBackToLinkedRuleBuilder
get, getNamespaceURI, getPattern, reportError, then
-
-
-
-
Field Detail
-
classLoader
private final java.lang.ClassLoader classLoader
-
type
private java.lang.Class<? extends ObjectCreationFactory<?>> type
-
attributeName
private java.lang.String attributeName
-
ignoreCreateExceptions
private boolean ignoreCreateExceptions
-
creationFactory
private ObjectCreationFactory<?> creationFactory
-
-
Constructor Detail
-
FactoryCreateBuilder
FactoryCreateBuilder(java.lang.String keyPattern, java.lang.String namespaceURI, RulesBinder mainBinder, LinkedRuleBuilder mainBuilder, java.lang.ClassLoader classLoader)
-
-
Method Detail
-
ofType
public FactoryCreateBuilder ofType(java.lang.String className)
Construct a factory create rule that will use the specified class name to create anObjectCreationFactory
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- Returns:
- this builder instance
-
ofType
public FactoryCreateBuilder ofType(java.lang.Class<? extends ObjectCreationFactory<?>> type)
Construct a factory create rule that will use the specified class to create anObjectCreationFactory
which will then be used to create an object and push it on the stack.- Parameters:
type
- Java class of the object creation factory class- Returns:
- this builder instance
-
usingFactory
public <T> FactoryCreateBuilder usingFactory(ObjectCreationFactory<T> creationFactory)
Construct a factory create rule using the given, already instantiated,ObjectCreationFactory
.- Type Parameters:
T
- the type of created object by the given factory- Parameters:
creationFactory
- called on to create the object- Returns:
- this builder instance
-
overriddenByAttribute
public FactoryCreateBuilder overriddenByAttribute(java.lang.String attributeName)
Allows specify the attribute containing an override class name if it is present.- Parameters:
attributeName
- The attribute containing an override class name if it is present- Returns:
- this builder instance
-
ignoreCreateExceptions
public FactoryCreateBuilder ignoreCreateExceptions(boolean ignoreCreateExceptions)
Exceptions thrown by the object creation factory will be ignored or not.- Parameters:
ignoreCreateExceptions
- if true, exceptions thrown by the object creation factory will be ignored- Returns:
- this builder instance
-
createRule
protected FactoryCreateRule createRule()
Provides an instance ofRule
. Must never return null.- Specified by:
createRule
in classAbstractBackToLinkedRuleBuilder<FactoryCreateRule>
- Returns:
- an instance of
Rule
. - See Also:
AbstractBackToLinkedRuleBuilder.get()
-
-