public abstract class AbstractMetatype
extends java.lang.Object
A metatype converter is defined as an extension to the point
com.ibm.xtools.transform.core.metatypeConverters
. The extension
enables the following data to be defined for a metatype converter:
All metatype converters must implement the following methods:
If the metatype is to be used as either a source or target model type for a transformation then the converter must be able to adapt a selection to a data object. The order of the metatypes in the transformation descriptor determines which metatype converter will be used. To support this feature, the converter must implement the following methods:
If the metatype is to be used for read-write transformation properties then a mechanism is needed for the user to change the value of the property before executing the transformation. This can be achieved in several ways. The transformation itself can define its own transform configuration tab to change property values, or the editable string support can be implemented by the converter. In this case, the editable string will be displayed in the UI property sheet (as text) and the modified string will be resolved back into a data object. If the converter supports this feature then it must implement the following methods:
The extension definition contains the fully qualified class (type class) that object must be an instance of for this metatype converter. This may not be sufficient for selecting the correct converter for a data object. The converter can perform more fine grained control by overriding the following method:
Constructor and Description |
---|
AbstractMetatype()
Constructor
|
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
adaptSelection(java.lang.Object selection)
Adapt a selected UI object into a metatype data object.
|
abstract java.lang.String |
getDisplayName(java.lang.Object dataObject)
Obtain a displayable name that represents the metatype data object.
|
java.lang.String |
getEditString(java.lang.Object dataObject)
Obtain a string representation of the metatype data object that a
user can edit.
|
abstract java.lang.String |
getReference(java.lang.Object dataObject)
Return a string representing the data object that can be persisted.
|
java.lang.Object |
getViewerObject(java.lang.Object dataObject)
Returns the object used to display the data object in a viewer such as
the common viewer.
|
boolean |
isMetatypeObject(java.lang.Object dataObject)
Verfiy that the data object is valid for this metatype.
|
AbstractMetatypeDataManager |
newMetatypeDataManager(ITransformationProperty property)
Returns a new instance of the metatype data manager for this converter.
|
java.lang.Object |
resolveEditString(java.lang.String editString)
Resolve a user editable string back into a metatype data object.
|
abstract java.lang.Object |
resolveReference(java.lang.String refString)
Resolve a string reference back into the corresponding data object.
|
java.lang.Object |
resolveReference(java.lang.String refString,
ITransformationProperty prop)
Resolve a string reference back into the corresponding data object.
|
public java.lang.Object adaptSelection(java.lang.Object selection)
selection
- the selected object in the UIpublic boolean isMetatypeObject(java.lang.Object dataObject)
Since the initial check against the typeClass is usually sufficient, this default implementation of the method will usually be sufficient.
dataObject
- the metatype data type object being verifiedpublic abstract java.lang.String getDisplayName(java.lang.Object dataObject)
dataObject
- the metatype data objectpublic abstract java.lang.String getReference(java.lang.Object dataObject)
dataObject
- the metatype data object to be persistedpublic abstract java.lang.Object resolveReference(java.lang.String refString)
refString
- a persistable string that represents the data objectpublic java.lang.Object resolveReference(java.lang.String refString, ITransformationProperty prop)
refString
- a persistable string that represents the data objectprop
- The transformation property that the data object is the
value of. It may contain metatype data needed to resolve the property.public java.lang.String getEditString(java.lang.Object dataObject)
dataObject
- the metatype data objectpublic java.lang.Object resolveEditString(java.lang.String editString)
editString
- a user editable string that represents the data objectpublic AbstractMetatypeDataManager newMetatypeDataManager(ITransformationProperty property)
property
- The transformation property that contains the metatype
data.public java.lang.Object getViewerObject(java.lang.Object dataObject)
dataObject
- The object for which to find a viewer object.