org.codehaus.modello.plugins.xml
Class AbstractXmlGenerator

java.lang.Object
  extended by org.codehaus.plexus.logging.AbstractLogEnabled
      extended by org.codehaus.modello.plugin.AbstractModelloGenerator
          extended by org.codehaus.modello.plugins.xml.AbstractXmlGenerator
All Implemented Interfaces:
ModelloGenerator, org.codehaus.plexus.logging.LogEnabled, org.codehaus.plexus.personality.plexus.lifecycle.phase.Contextualizable
Direct Known Subclasses:
XdocGenerator, XsdGenerator

public abstract class AbstractXmlGenerator
extends AbstractModelloGenerator

Abstract class for plugins working on XML representation of the model, without having any need to generate Java code.

Version:
$Id: AbstractXmlGenerator.java 1273 2009-07-04 14:46:19Z bentmann $
Author:
Hervé Boutemy

Constructor Summary
AbstractXmlGenerator()
           
 
Method Summary
protected  List getAttributeFieldsForClass(ModelClass modelClass)
          Return the child attribute fields of this class.
protected  ModelField getContentField(List modelFields)
          Get the field which type is Content if any.
protected  List getNonTransientFields(List modelFields)
          Gets all fields that are not marked as transient.
protected  boolean hasContentField(List modelFields)
           
protected  void initHeader(org.codehaus.plexus.util.xml.XMLWriter w)
           
protected  String resolveTagName(ModelClass modelClass)
          Resolve XML tag name for a class.
protected  String resolveTagName(ModelField modelField, XmlFieldMetadata xmlFieldMetadata)
          Resolve XML tag name for a field.
protected  String resolveTagName(String fieldTagName, XmlAssociationMetadata xmlAssociationMetadata)
          Resolve XML tag name for an item in an association with many multiplicity.
 
Methods inherited from class org.codehaus.modello.plugin.AbstractModelloGenerator
capitalise, contextualize, getBuildContext, getEncoding, getFieldsForClass, getGeneratedVersion, getHeader, getModel, getOutputDirectory, getParameter, getParameter, getParameter, initialize, isClassInModel, isCollection, isEmpty, isInnerAssociation, isMap, isPackageWithVersion, singular, uncapitalise
 
Methods inherited from class org.codehaus.plexus.logging.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.codehaus.modello.plugin.ModelloGenerator
generate
 

Constructor Detail

AbstractXmlGenerator

public AbstractXmlGenerator()
Method Detail

initHeader

protected void initHeader(org.codehaus.plexus.util.xml.XMLWriter w)

resolveTagName

protected String resolveTagName(ModelClass modelClass)
Resolve XML tag name for a class. Note: only root class needs such a resolution.

Parameters:
modelClass - the model class
Returns:
the XML tag name for the class

resolveTagName

protected String resolveTagName(ModelField modelField,
                                XmlFieldMetadata xmlFieldMetadata)
Resolve XML tag name for a field.

Parameters:
modelField - the model field
xmlFieldMetadata - the XML metadata of the field
Returns:
the XML tag name for the field

resolveTagName

protected String resolveTagName(String fieldTagName,
                                XmlAssociationMetadata xmlAssociationMetadata)
Resolve XML tag name for an item in an association with many multiplicity.

Parameters:
fieldTagName - the XML tag name of the field containing the association
xmlAssociationMetadata - the XML metadata of the association
Returns:
the XML tag name for items

getAttributeFieldsForClass

protected List getAttributeFieldsForClass(ModelClass modelClass)
Return the child attribute fields of this class.

Parameters:
modelClass - current class
Returns:
the list of attribute fields of this class

hasContentField

protected boolean hasContentField(List modelFields)

getContentField

protected ModelField getContentField(List modelFields)
Get the field which type is Content if any.

Parameters:
modelFields - the fields to check
Returns:
the field, or null if no field is Content

getNonTransientFields

protected List getNonTransientFields(List modelFields)
Gets all fields that are not marked as transient.

Parameters:
modelFields - The collection of model fields from which to extract the non-transient fields, must not be null.
Returns:
The list of non-transient fields, can be empty but never null.


Copyright © 2001-2013 Codehaus. All Rights Reserved.