Package eu.bandm.tools.ramus.ogma
Class Factory
java.lang.Object
eu.bandm.tools.ramus.ogma.Factory
- Direct Known Subclasses:
ParserFactory,ReadingFactory,ReducerFactory
Base class of configurable factories for parsers and related objects.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceInterface of factory configuration settings. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final Factory.ConfigurationThe configuration to apply when constructing objects.The module name used to distinguish caller code pertaining to the parser construction service from client code.static final StringThe package prefix used to distinguish caller code pertaining to the parser construction service from client code. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedFactory(Factory.Configuration configuration) Creates a new factory. -
Method Summary
Modifier and TypeMethodDescriptionprotected <O> OManages the construction of an object by this factory.protected static Factory.ConfigurationReturns a default configuration.Returns the configuration of this factory.static booleanChecks whether a caller on the stack trace belongs to the parser construction service, by virtue of belonging to the same module.static booleanChecks whether a caller on the stack trace belongs to the parser construction service, by virtue of belonging to the same package.
-
Field Details
-
PACKAGE_PREFIX
The package prefix used to distinguish caller code pertaining to the parser construction service from client code. -
MODULE_NAME
The module name used to distinguish caller code pertaining to the parser construction service from client code. -
configuration
The configuration to apply when constructing objects.
-
-
Constructor Details
-
Factory
Creates a new factory.- Parameters:
configuration- the configuration to apply when constructing objects- Throws:
NullPointerException- ifconfigurationis null
-
-
Method Details
-
defaultConfiguration
Returns a default configuration.The default configuration has the following settings:
- capturingCallerLocations
false- creationWatcher
null- serviceFilter
filterServicePackage
- Returns:
- a default configuration
-
serviceFilterByPackage
Checks whether a caller on the stack trace belongs to the parser construction service, by virtue of belonging to the same package.- Parameters:
e- a stack trace element- Returns:
trueif the containing class of the caller represented byebelongs to the same package as this class;falseotherwise- Throws:
NullPointerException- ifeis null
-
serviceFilterByModule
Checks whether a caller on the stack trace belongs to the parser construction service, by virtue of belonging to the same module.- Parameters:
e- a stack trace element- Returns:
trueif the containing class of the caller represented byebelongs to the same module as this class;falseotherwise- Throws:
NullPointerException- ifeis null
-
getConfiguration
Returns the configuration of this factory.- Returns:
- the configuration of this factory
-
construct
Manages the construction of an object by this factory.Depending on the configuration, a caller location for this construction operation may be obtained, and/or a watcher may be notified of the construction event.
- Type Parameters:
O- the type of object to construct- Parameters:
constructor- the function to construct the new object, given a caller location ornullif not available- Returns:
- the newly constructed object
- Throws:
NullPointerException- ifconstructoris null
-