org.enhydra.zeus
Interface Transformer

All Known Implementing Classes:
BaseTransformer

public interface Transformer

Transformer is the interface for converting a set of Zeus Binder objects from a set of XML-based names (created by a Zeus Binder instance) and identities to another set of Binding objects. This second set of objects is only an intermediate set, which is then used by a Generator to create Java classes.

This allows a user to specify a mapping file and thereby transform a set of XML names into another set of names, either for ensuring legal Java names, for using more business-centric names, or any other user desired basis.

Author:
Brett McLaughlin

Method Summary
 void addValueEnumeration(ValueEnumeration valueEnumeration)
           This will add a new ValueEnumeration to those available to this Transformer.
 TransformerOptions getTransformerOptions()
           This returns the current TransformerOptions for this transformer.
 ValueEnumeration getValueEnumeration(java.lang.String name)
           This will retrieve the ValueEnumeration for the supplied name.
 void setTransformerOptions(TransformerOptions transformerOptions)
           This allows setting of the TransformerOptions for this transformer.
 java.util.List transform(java.util.List bindings)
           This method performs the work of transforming a set of Zeus Binding objects.
 

Method Detail

setTransformerOptions

public void setTransformerOptions(TransformerOptions transformerOptions)

This allows setting of the TransformerOptions for this transformer.

Parameters:
transformerOptions - the options for this transformer

getTransformerOptions

public TransformerOptions getTransformerOptions()

This returns the current TransformerOptions for this transformer.

Returns:
TransformerOptions - the options in use for this transformer.

addValueEnumeration

public void addValueEnumeration(ValueEnumeration valueEnumeration)

This will add a new ValueEnumeration to those available to this Transformer.

Parameters:
valueEnumeration - the enumeration to add for this transformer.

getValueEnumeration

public ValueEnumeration getValueEnumeration(java.lang.String name)
                                     throws NoSuchValueEnumerationException

This will retrieve the ValueEnumeration for the supplied name.

If the supplied name is not associated with a ValueEnumeration, this is considered an exceptional condition; any Transformer construct looking for a ValueEnumeration by name expects to find one, or the supplied mapping information is in error. Therefore, in this case, a NoSuchValueEnumerationException is thrown.

Returns:
ValueEnumeration - the enumeration for the supplied name.
Throws:
NoSuchValueEnumerationException - - when an enumeration with the supplied name cannot be found.

transform

public java.util.List transform(java.util.List bindings)
                         throws java.io.IOException,
                                ZeusException

This method performs the work of transforming a set of Zeus Binding objects. It then returns a new set of Binding objects (in List form) with transformed names, types, and values.

When this method is invoked, it attempts to see if parsing of the mapping file has already occurred. If it has not, parsing of that file will occur within this method.

It is important to note that the number of bindings returned from this method may not be the same as the number supplied. This is due to some XML elements/attributes being converted to value objects, while other mapping instructions may actually create new binding objects.

Parameters:
bindings - List of bindings to process for transformation.
Returns:
List - the transformed bindings.
Throws:
IOException - - when errors occur in parsing a mapping configuration file.
ZeusException - - when errors occuring in transformation.


Copyright © 2002 Enhydra. All Rights Reserved.