|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.ashridgetech.jamda.transform.AbstractModelTransformer | +--com.ashridgetech.jamda.transform.BasicTransformer
A basics for ModelTransformer
implementation
that applies a given ElementTransformer
to
ModelElement
s with a given Stereotype
.
May be subclassed for more specialised transformations.
Must be configured with the class of the ElementTransformer
to apply
as well as the configuration required by AbstractModelTransformer
.
BasicTransformerSpec
Nested Class Summary |
Nested classes inherited from class com.ashridgetech.jamda.transform.AbstractModelTransformer |
AbstractModelTransformer.Config |
Nested classes inherited from class com.ashridgetech.jamda.transform.ModelTransformer |
ModelTransformer.TransformException |
Constructor Summary | |
BasicTransformer()
|
Method Summary | |
java.lang.String |
getDescription()
Get a short description of this transformer, including details of its configuration. |
java.lang.Class |
getElementTransformerClass()
Get the class which will process the selected elements. |
java.lang.Class |
getElementTransformerSuperclass()
Get the class which must be the superclass of any class set by setElementTransformerClass(java.lang.Class) . |
protected ElementTransformer |
makeElementTransformer(ModelElement element)
Create an ElementTransformer which can process the source element. |
void |
setElementTransformerClass(java.lang.Class elementTransformerClass)
Set the class which will process the selected elements. |
void |
setElementTransformerSuperclass(java.lang.Class elementTransformerSuperclass)
Set the class which must be the superclass of any class set by setElementTransformerClass(java.lang.Class) . |
java.util.Collection |
standardElementDefs()
Get the definitions of the standard model elements required by the transformer. |
void |
transform(Model model)
Process the selected elements in a Model . |
void |
validateTransformerClass(java.lang.Class elementTransformerClass)
Validate the elementTransformerClass passed to setElementTransformerClass(java.lang.Class) . |
Methods inherited from class com.ashridgetech.jamda.transform.AbstractModelTransformer |
addStereotypeName, getConfig, getStereotypeNames, selectElements, setStereotypeName |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public BasicTransformer()
Method Detail |
public java.lang.Class getElementTransformerClass()
setElementTransformerClass(java.lang.Class)
public void setElementTransformerClass(java.lang.Class elementTransformerClass) throws ModelTransformer.TransformException
validateTransformerClass(java.lang.Class)
to check elementTransformerClass
.
elementTransformerClass
- the transformer class
ModelTransformer.TransformException
public java.lang.Class getElementTransformerSuperclass()
setElementTransformerClass(java.lang.Class)
.
setElementTransformerClass(java.lang.Class)
,
setElementTransformerSuperclass(java.lang.Class)
public void setElementTransformerSuperclass(java.lang.Class elementTransformerSuperclass)
setElementTransformerClass(java.lang.Class)
.
This is used by validateTransformerClass(java.lang.Class)
to check the class passed to
setElementTransformerClass(java.lang.Class)
.
elementTransformerSuperclass
- the transformer class - may be null.
The class must implement ElementTransformer
.public void validateTransformerClass(java.lang.Class elementTransformerClass) throws ModelTransformer.TransformException
elementTransformerClass
passed to setElementTransformerClass(java.lang.Class)
.
This implementation checks that the elementTransformerClass
is assignable
to the class returned getElementTransformerSuperclass()
, if it is not null.
elementTransformerClass
- the class to validate
TransformException
- if the class is not valid for some reason
ModelTransformer.TransformException
public void transform(Model model) throws ModelTransformer.TransformException
Model
.
model
- the Model
on which to operate
ModelTransformer.TransformException
public java.lang.String getDescription()
getDescription
in interface ModelTransformer
getDescription
in class AbstractModelTransformer
public java.util.Collection standardElementDefs() throws ModelTransformer.TransformException
setElementTransformerClass(java.lang.Class)
has a public static method
called standardElementDefs
, which returns a Collection
,
call it and return its return value. Otherwise return an empty Collection
.
standardElementDefs
in interface ModelTransformer
standardElementDefs
in class AbstractModelTransformer
ModelTransformer.TransformException
protected ElementTransformer makeElementTransformer(ModelElement element) throws ModelTransformer.TransformException
ElementTransformer
which can process the source element.
The default action of this implementation is to attempt to
create an instance of the class set in setElementTransformerClass(java.lang.Class)
,
passing element
to its constructor.
element
- the UML element for which the transformer is needed
ModelTransformer.TransformException
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |