org.nuiton.wikitty.generator
Class WikittyPurifierTransformer

java.lang.Object
  extended by org.nuiton.eugene.Template<I>
      extended by org.nuiton.eugene.Transformer<org.nuiton.eugene.models.object.ObjectModel,O>
          extended by org.nuiton.eugene.models.object.ObjectModelTransformer<org.nuiton.eugene.models.object.ObjectModel>
              extended by org.nuiton.wikitty.generator.WikittyPurifierTransformer
All Implemented Interfaces:
org.nuiton.eugene.TemplateConfiguration

public class WikittyPurifierTransformer
extends org.nuiton.eugene.models.object.ObjectModelTransformer<org.nuiton.eugene.models.object.ObjectModel>

This transformer read the original user model and generate the intermediate model needed by generators. Currently: - manage name collision for attributes or methods inherited from two different classes


Field Summary
protected  org.nuiton.eugene.models.object.ObjectModelBuilder builder
          Generated model builder.
protected  Map<org.nuiton.eugene.models.object.ObjectModelClass,List<String>> namesUsedByClass
          for a given class, store all the names used by this class and subClasses
protected  List<org.nuiton.eugene.models.object.ObjectModelClass> processedClasses
          class of the original model that are already processed
 
Fields inherited from class org.nuiton.eugene.Transformer
outputModel, outputProperties, outputTemplate, previousTransformer
 
Fields inherited from class org.nuiton.eugene.Template
configuration, excludeTemplates, generatedPackages, model
 
Fields inherited from interface org.nuiton.eugene.TemplateConfiguration
PROP_CLASS_LOADER, PROP_DEFAULT_PACKAGE, PROP_ENCODING, PROP_EXCLUDE_TEMPLATES, PROP_GENERATED_PACKAGES, PROP_LAST_MODIFIED_SOURCE, PROP_OVERWRITE, PROP_VERBOSE, PROP_WRITER_REPORT
 
Constructor Summary
WikittyPurifierTransformer()
           
 
Method Summary
protected  org.nuiton.eugene.models.object.ObjectModelAttribute cloneAttribute(org.nuiton.eugene.models.object.ObjectModelAttribute source, org.nuiton.eugene.models.object.ObjectModelClassifier destination, boolean cloneDocumentation, org.nuiton.eugene.models.object.ObjectModelModifier... modifiers)
          clone a given attribute into a classifier of the output model
 org.nuiton.eugene.models.object.ObjectModelClass cloneClass(org.nuiton.eugene.models.object.ObjectModelClass source, boolean cloneDocumentation)
          creates a clone of the given source class in the output model and clones attributes, inheritance declarations and operations into the clone
 org.nuiton.eugene.models.object.ObjectModelClassifier cloneClassifier(org.nuiton.eugene.models.object.ObjectModelClassifier source, boolean cloneDocumentation)
          creates a clone of the given source classifier in the output model and clones attributes, inheritance declaration and operations class-specific, enumeration-specific and interface-specific features of the given classifier will be present in the clone
protected  void cloneClassifier(org.nuiton.eugene.models.object.ObjectModelClassifier source, org.nuiton.eugene.models.object.ObjectModelClassifier destination, boolean copyDocumentation)
          copy attributes, interfaces declaration and operation of a given classifier into another classifier.
 org.nuiton.eugene.models.object.ObjectModelEnumeration cloneEnumeration(org.nuiton.eugene.models.object.ObjectModelEnumeration source, boolean cloneDocumentation)
          creates a clone of the given source enumeration in the output model and clones attributes, inheritance declaration, operations and literals into the clone
 org.nuiton.eugene.models.object.ObjectModelInterface cloneInterface(org.nuiton.eugene.models.object.ObjectModelInterface source, boolean cloneDocumentation)
          creates a clone of the given source interface in the output model and clones attributes, inheritance declaration and operations into the clone
 org.nuiton.eugene.models.object.ObjectModelOperation cloneOperation(org.nuiton.eugene.models.object.ObjectModelOperation source, org.nuiton.eugene.models.object.ObjectModelClassifier destination, boolean cloneDocumentation, org.nuiton.eugene.models.object.ObjectModelModifier... modifiers)
          Clone the source operation into the destination classifier.
 org.nuiton.eugene.models.object.ObjectModelOperation cloneOperationSignature(org.nuiton.eugene.models.object.ObjectModelOperation source, org.nuiton.eugene.models.object.ObjectModelClassifier destination, boolean cloneDocumentation, org.nuiton.eugene.models.object.ObjectModelModifier... modifiers)
          Clone the source operation into the destination classifier.
protected  void cloneStereotypes(org.nuiton.eugene.models.object.ObjectModelClassifier source, org.nuiton.eugene.models.object.ObjectModelClassifier destination)
           
protected  void cloneTagValues(org.nuiton.eugene.models.object.ObjectModelElement source, org.nuiton.eugene.models.object.ObjectModelElement destination)
          Copy all tag values for the given source to the given destination.
protected  void debugOutputModel()
           
protected  org.nuiton.eugene.models.object.ObjectModel initOutputModel()
           
protected  org.nuiton.eugene.Template<org.nuiton.eugene.models.object.ObjectModel> initOutputTemplate()
           
protected  void processClass(org.nuiton.eugene.models.object.ObjectModelClass clazz)
          for a given, class read all attributes name and try to find conflicts with parent classes attributes names.
 void transformFromModel(org.nuiton.eugene.models.object.ObjectModel model)
           
 
Methods inherited from class org.nuiton.eugene.models.object.ObjectModelTransformer
transform, transformFromClass, transformFromClassifier, transformFromElement, transformFromEnumeration, transformFromInterface
 
Methods inherited from class org.nuiton.eugene.Transformer
applyTemplate, getOutputModel, getOutputProperties, getOutputTemplate, init, initPreviousTransformer, transform
 
Methods inherited from class org.nuiton.eugene.Template
getClassLoader, getConfiguration, getEncoding, getExcludeTemplates, getGeneratedPackages, getLastModifiedSource, getModel, getOverwrite, getProperties, getProperty, getProperty, getWriterReport, isOverwrite, isVerbose, setConfiguration, setProperty
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

namesUsedByClass

protected Map<org.nuiton.eugene.models.object.ObjectModelClass,List<String>> namesUsedByClass
for a given class, store all the names used by this class and subClasses


processedClasses

protected List<org.nuiton.eugene.models.object.ObjectModelClass> processedClasses
class of the original model that are already processed


builder

protected org.nuiton.eugene.models.object.ObjectModelBuilder builder
Generated model builder.

Constructor Detail

WikittyPurifierTransformer

public WikittyPurifierTransformer()
Method Detail

processClass

protected void processClass(org.nuiton.eugene.models.object.ObjectModelClass clazz)
for a given, class read all attributes name and try to find conflicts with parent classes attributes names. If a conflict is found, we try to solve the conflict by adding an tagValue to the conflicting attribute for others transformers to consider it as a new name. To choose a new name, we look for an alternative name provided by the user through a tagValue on this attribute. If no alternative provided, we try to generate an alternative name by adding "From" to the attribute name.

Parameters:
clazz - the class to process

transformFromModel

public void transformFromModel(org.nuiton.eugene.models.object.ObjectModel model)
Overrides:
transformFromModel in class org.nuiton.eugene.models.object.ObjectModelTransformer<org.nuiton.eugene.models.object.ObjectModel>

initOutputTemplate

protected org.nuiton.eugene.Template<org.nuiton.eugene.models.object.ObjectModel> initOutputTemplate()
Specified by:
initOutputTemplate in class org.nuiton.eugene.Transformer<org.nuiton.eugene.models.object.ObjectModel,org.nuiton.eugene.models.object.ObjectModel>

debugOutputModel

protected void debugOutputModel()
Specified by:
debugOutputModel in class org.nuiton.eugene.models.object.ObjectModelTransformer<org.nuiton.eugene.models.object.ObjectModel>

initOutputModel

protected org.nuiton.eugene.models.object.ObjectModel initOutputModel()
Specified by:
initOutputModel in class org.nuiton.eugene.Transformer<org.nuiton.eugene.models.object.ObjectModel,org.nuiton.eugene.models.object.ObjectModel>

cloneClass

public org.nuiton.eugene.models.object.ObjectModelClass cloneClass(org.nuiton.eugene.models.object.ObjectModelClass source,
                                                                   boolean cloneDocumentation)
creates a clone of the given source class in the output model and clones attributes, inheritance declarations and operations into the clone

Parameters:
source - the class to clone from the source model
cloneDocumentation - flag to add documentation if some found in model
Returns:
the clone of the given class

cloneClassifier

public org.nuiton.eugene.models.object.ObjectModelClassifier cloneClassifier(org.nuiton.eugene.models.object.ObjectModelClassifier source,
                                                                             boolean cloneDocumentation)
creates a clone of the given source classifier in the output model and clones attributes, inheritance declaration and operations class-specific, enumeration-specific and interface-specific features of the given classifier will be present in the clone

Parameters:
source - the classifier to clone from the source model
cloneDocumentation - flag to add documentation if some found in model
Returns:
the clone of the given classifier

cloneInterface

public org.nuiton.eugene.models.object.ObjectModelInterface cloneInterface(org.nuiton.eugene.models.object.ObjectModelInterface source,
                                                                           boolean cloneDocumentation)
creates a clone of the given source interface in the output model and clones attributes, inheritance declaration and operations into the clone

Parameters:
source - the interface to clone from the source model
cloneDocumentation - flag to add documentation if some found in model
Returns:
the clone of the given interface

cloneEnumeration

public org.nuiton.eugene.models.object.ObjectModelEnumeration cloneEnumeration(org.nuiton.eugene.models.object.ObjectModelEnumeration source,
                                                                               boolean cloneDocumentation)
creates a clone of the given source enumeration in the output model and clones attributes, inheritance declaration, operations and literals into the clone

Parameters:
source - the enumeration to clone from the source model
cloneDocumentation - flag to add documentation if some found in model
Returns:
the clone of the given enumeration

cloneClassifier

protected void cloneClassifier(org.nuiton.eugene.models.object.ObjectModelClassifier source,
                               org.nuiton.eugene.models.object.ObjectModelClassifier destination,
                               boolean copyDocumentation)
copy attributes, interfaces declaration and operation of a given classifier into another classifier. class-specific, enumeration-specific and interface-specific features of the given classifier will not be present in the clone. To copy those specific elements, use cloneClassifier(ObjectModelClassifier, boolean)

Parameters:
source - the classifier to clone from the source model
destination - where to clone the given source one
copyDocumentation - flag to add documentation if some found in model

cloneOperation

public org.nuiton.eugene.models.object.ObjectModelOperation cloneOperation(org.nuiton.eugene.models.object.ObjectModelOperation source,
                                                                           org.nuiton.eugene.models.object.ObjectModelClassifier destination,
                                                                           boolean cloneDocumentation,
                                                                           org.nuiton.eugene.models.object.ObjectModelModifier... modifiers)
Clone the source operation into the destination classifier. whole signature, tagValues and body code will be cloned. You can specify modifiers for the result operation.

Parameters:
source - operation to clone
destination - classifier where result operation will be added
cloneDocumentation - flag to add documentation if some found in model
modifiers - extra modifiers
Returns:
the new operation created in destination classifier

cloneTagValues

protected void cloneTagValues(org.nuiton.eugene.models.object.ObjectModelElement source,
                              org.nuiton.eugene.models.object.ObjectModelElement destination)
Copy all tag values for the given source to the given destination.

Parameters:
source - the source element
destination - the destination element

cloneStereotypes

protected void cloneStereotypes(org.nuiton.eugene.models.object.ObjectModelClassifier source,
                                org.nuiton.eugene.models.object.ObjectModelClassifier destination)
Parameters:
source -
destination -

cloneOperationSignature

public org.nuiton.eugene.models.object.ObjectModelOperation cloneOperationSignature(org.nuiton.eugene.models.object.ObjectModelOperation source,
                                                                                    org.nuiton.eugene.models.object.ObjectModelClassifier destination,
                                                                                    boolean cloneDocumentation,
                                                                                    org.nuiton.eugene.models.object.ObjectModelModifier... modifiers)
Clone the source operation into the destination classifier. name, returnType, parameters, exceptions and tagValues will be cloned. You can specify modifiers for the result operation.

Parameters:
source - operation to clone
destination - classifier where result operation will be added
cloneDocumentation - flag to add documentation if some found in model
modifiers - extra modifiers
Returns:
the new operation created in destination classifier

cloneAttribute

protected org.nuiton.eugene.models.object.ObjectModelAttribute cloneAttribute(org.nuiton.eugene.models.object.ObjectModelAttribute source,
                                                                              org.nuiton.eugene.models.object.ObjectModelClassifier destination,
                                                                              boolean cloneDocumentation,
                                                                              org.nuiton.eugene.models.object.ObjectModelModifier... modifiers)
clone a given attribute into a classifier of the output model

Parameters:
source - the original attribute
destination - classifier where the clone will be added
cloneDocumentation - flag to add documentation if some found in model
modifiers - extra modifiers
Returns:
the clone attribute


Copyright © 2009-2011 CodeLutin. All Rights Reserved.