public abstract class TransformFramework
extends java.lang.Object
This is the central class in the package and it represents the base class of
all transform frameworks. The transform(Source,Source,Target)
method
of a concrete sub-classed implementation performs the actual transformation
of data.
The class has methods which allow a client application to add transformation
rules ahead of their actual use. If a rule is unknown to an instance of a
transform framework at the time of invoking the
transform(Source,Source,Target)
method, then the rule is added to
the object's internal list of rules for further reuse.
Modifier and Type | Field and Description |
---|---|
protected org.slf4j.Logger |
log
Used for providing logging information.
|
protected RuleList |
ruleList
Internal store of transformation rules.
|
Constructor and Description |
---|
TransformFramework() |
Modifier and Type | Method and Description |
---|---|
abstract void |
addRule(Source rule)
Adds a rule.
|
int |
getNumRules()
Returns the number of rules currently held within
TransformFramework . |
int |
indexOfRule(Source rule)
Returns the index position of a rule contained in
TransformFramework . |
void |
removeRule(int index)
Removes a rule.
|
void |
removeRule(Source rule)
Removes a rule.
|
void |
removeRules()
Removes all the rules from
TransformFramework . |
abstract void |
transform(Source in,
Source rule,
Target out)
Performs the transformation.
|
protected RuleList ruleList
Internal store of transformation rules.
protected transient org.slf4j.Logger log
Used for providing logging information.
public int indexOfRule(Source rule)
Returns the index position of a rule contained in
TransformFramework
.
rule
- the rule to find the index of.removeRule(int)
public int getNumRules()
Returns the number of rules currently held within
TransformFramework
.
public void removeRule(Source rule)
Removes a rule.
rule
- the rule to remove.indexOfRule(Source)
,
removeRule(int)
public void removeRule(int index)
Removes a rule.
index
- the index position of the rule to remove.indexOfRule(Source)
,
removeRule(Source)
public void removeRules()
Removes all the rules from TransformFramework
.
public abstract void transform(Source in, Source rule, Target out) throws java.lang.Exception
Performs the transformation.
This object must not be reused until the method synchronously returns to the caller.
in
- the input that is to be transformed.rule
- the specific rule to use in the transformation.out
- the output of the transformation.java.lang.Exception
- when there is an error detected during transformation.public abstract void addRule(Source rule) throws java.lang.Exception
Adds a rule. This method is made abstract as it is up to the sub-class to determine how a rule is to be optimised. Refer to RuleList for further details.
rule
- the rule to add.java.lang.Exception
- when there is an error detected adding a rule.