ch.sahits.codegen.xml
Class XMLParserWithoutDB

java.lang.Object
  extended by ch.sahits.codegen.input.XMLJDomParser
      extended by ch.sahits.codegen.xml.XMLParserWithoutDB
All Implemented Interfaces:
IInputParser, IXMLInputFileParser, IXMLJavaInputFileParser

public final class XMLParserWithoutDB
extends XMLJDomParser
implements IXMLJavaInputFileParser

This XML parser parses an XML file of the format

 <bean>
 <modelgenerator>ch.sahits.codegen.xml.XMLParserWithoutDB</modelgenerator>
 <attribute>ch.sahits.codegen.example.Name</attribute>
 <attribute>ch.sahits.codegen.example.Description</attribute>
 <attribute>ch.sahits.codegen.example.Message</attribute>
 </bean>
 
This creates a simple bean. Since this is an example for generating something without a database in the back we would need some other model than DataBaseTable. But for conveniance sake we create a DataBaseTable of it.

Since:
0.9.4
Author:
Andi Hotz

Field Summary
static java.lang.String PLUGIN_ID
          Plugin-ID
 
Fields inherited from class ch.sahits.codegen.input.XMLJDomParser
document, root
 
Constructor Summary
XMLParserWithoutDB()
          Default constructor
 
Method Summary
 IGeneratedJavaClass2 generateModel(java.lang.String className)
          Create a Bean model based on a DataBaseTable
 IGeneratedJavaClass generateModel(java.lang.String className, java.lang.String packageName, boolean isPublic, boolean isAbstract, boolean isFinal)
          Pass the call to generateModel(String)
 int getWorkload()
          Defines how complex the generation of the model is.
 void init(java.lang.String inputFile)
          Initialize the XML file
 boolean isInitialized()
          Check whether the class is correctly initialized by calling init(String) successfully
 EDBConnectionData needsDataBaseInformationForCompleetion()
          Indicate if the input file is self contained or if for compleetion of the model information from the second page is needed.
 
Methods inherited from class ch.sahits.codegen.input.XMLJDomParser
getAllAttributes, getAllElements, getAttributeValue, getFileExtension, getFirstElement, getParserName, getPredecessor, getRanking, hasChild, hasChild, hasText, lookup, parse, setNamespace
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface ch.sahits.codegen.java.input.IXMLJavaInputFileParser
parse
 
Methods inherited from interface ch.sahits.codegen.input.IInputParser
getFileExtension, getRanking
 

Field Detail

PLUGIN_ID

public static final java.lang.String PLUGIN_ID
Plugin-ID

See Also:
Constant Field Values
Constructor Detail

XMLParserWithoutDB

public XMLParserWithoutDB()
Default constructor

Method Detail

init

public void init(java.lang.String inputFile)
Initialize the XML file

Specified by:
init in interface IInputParser
Overrides:
init in class XMLJDomParser
Parameters:
inputFile - Input parser

generateModel

public IGeneratedJavaClass2 generateModel(java.lang.String className)
Create a Bean model based on a DataBaseTable

Parameters:
className - Name of the class to be generated
Returns:
model of the class to be generated

isInitialized

public boolean isInitialized()
Check whether the class is correctly initialized by calling init(String) successfully

Specified by:
isInitialized in interface IXMLInputFileParser
Returns:
true if propertly initialized

getWorkload

public int getWorkload()
Defines how complex the generation of the model is.

Specified by:
getWorkload in interface IInputParser
Returns:
Number of work steps

generateModel

public IGeneratedJavaClass generateModel(java.lang.String className,
                                         java.lang.String packageName,
                                         boolean isPublic,
                                         boolean isAbstract,
                                         boolean isFinal)
Pass the call to generateModel(String)

Specified by:
generateModel in interface IXMLJavaInputFileParser
Parameters:
className - Name of the class
packageName - null
isPublic - false
isAbstract - false
isFinal - false
Returns:
generated class

needsDataBaseInformationForCompleetion

public EDBConnectionData needsDataBaseInformationForCompleetion()
Indicate if the input file is self contained or if for compleetion of the model information from the second page is needed.

Specified by:
needsDataBaseInformationForCompleetion in interface IInputParser
Returns: