|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.legstar.codegen.models.AbstractPropertiesModel com.legstar.codegen.models.AbstractAntBuildModel com.legstar.coxb.gen.CoxbGenModel
public class CoxbGenModel
A model usable for Binding classes generation. Groups all the data needed to generate a set of binding classes and an intermediary set of jaxb classes from a COBOL-annotated XML schema. Gathers all parameters that are needed during the lifetime of the generation process. This allows more parameters to be added without too much impact on other classes.
Field Summary | |
---|---|
static String |
COXB_COXBBINDIR
COXB binaries directory. |
static String |
COXB_COXBSRCDIR
COXB source directory. |
static String |
COXB_GENERATOR_NAME
This generator name. |
static String |
COXB_IS_COMPILE_TRANSFORMERS
Compile Transformers. |
static String |
COXB_ISJSONTRANSFORMERS
Generate JSON Transformers. |
static String |
COXB_ISXMLTRANSFORMERS
Generate XML Transformers. |
static String |
COXB_JAXB_ALTERNATIVEFACTORYNAME
JAXB alternate object factory. |
static String |
COXB_JAXB_ALTERNATIVEPACKAGENAME
JAXB alternate package name. |
static String |
COXB_JAXBBINDIR
JAXB binaries directory. |
static String |
COXB_JAXBROOTCLASSNAMES
JAXB root class names. |
static String |
COXB_JAXBSRCDIR
JAXB source directory. |
static String |
COXB_PACKAGENAME
COXB package name. |
static String |
COXB_UNMARSHAL_CHOICE_STRATEGIES
Unmarshal choice strategies. |
static String |
COXB_VELOCITY_MACRO_NAME
This velocity template. |
static String |
COXB_XSDFILE
XML Schema file. |
static boolean |
DEFAULT_IS_COMPILE_TRANSFORMERS
Default value for transformers compilation. |
static boolean |
DEFAULT_ISJSONTRANSFORMERS
Default value for JSON transformers generation. |
static boolean |
DEFAULT_ISXMLTRANSFORMERS
Default value for XML transformers generation. |
static String |
DEFAULT_JAXB_PACKAGENAME
When XML Schema does not contain a target namespace, JAXB uses this default package name. |
Fields inherited from class com.legstar.codegen.models.AbstractAntBuildModel |
---|
ANT_FILE_PREFIX, ANT_FILE_SUFFIX |
Constructor Summary | |
---|---|
CoxbGenModel()
A no-Arg constructor. |
|
CoxbGenModel(Properties props)
Construct from a properties file. |
Method Summary | |
---|---|
void |
addJaxbRootClassName(String className)
Adds a jaxb root class name to generate a binding class for. |
void |
addUnmarshalChoiceStrategy(UnmarshalChoiceStrategy unmarshalChoiceStrategy)
Add a choice strategy to inject in generated bindings. |
void |
generateBuild(File scriptFile)
Creates an ant build script file ready for binding generation. |
String |
getAlternativeFactoryName()
|
String |
getAlternativePackageName()
|
File |
getCoxbBinDir()
|
String |
getCoxbPackageName()
|
File |
getCoxbSrcDir()
|
protected DocumentBuilder |
getDocBuilder()
Creates a DOM document builder if none has already been created. |
String |
getElementNamePrefix()
|
String |
getElementNameSuffix()
|
File |
getJaxbBinDir()
|
String |
getJaxbClassIncludes()
Turn the JAXB package name into an include statement that we can used as an includes property for a javac ant step. |
JaxbGenModel |
getJaxbGenModel()
|
String |
getJaxbPackageName()
|
String |
getJaxbPackageNameFromXsd(File xsdFile)
Extracts the JAXB package name from the XML schema targetNamespace. |
List<String> |
getJaxbRootClassNames()
|
File |
getJaxbSrcDir()
This is not strictly needed for binding generation but is useful when this model is also used for JAXB classes generation. |
long |
getSerializableUid()
|
String |
getTypeNamePrefix()
|
String |
getTypeNameSuffix()
|
List<UnmarshalChoiceStrategy> |
getUnmarshalChoiceStrategies()
Unmarshal choice strategies to inject in generated bindings. |
File |
getXsdFile()
|
boolean |
isCompileTransformers()
|
boolean |
isEciCompatible()
Whether the ECI naming conventions should be used. |
boolean |
isGenerateIsSetMethod()
|
boolean |
isJsonTransformers()
|
boolean |
isNoPackageInfo()
Prevents generation of JAXB package-info.java which does not compile under JDK 1.5. |
boolean |
isXmlTransformers()
|
void |
setAlternativeFactoryName(String targetFactoryName)
|
void |
setAlternativePackageName(String alternativePackageName)
|
void |
setCompileTransformers(boolean compileTransformers)
|
void |
setCoxbBinDir(File coxbBinDir)
|
void |
setCoxbPackageName(String coxbPackageName)
|
void |
setCoxbSrcDir(File targetDir)
|
void |
setEciCompatible(boolean eciCompatible)
Whether the ECI naming conventions should be used. |
void |
setElementNamePrefix(String elementNamePrefix)
|
void |
setElementNameSuffix(String elementNameSuffix)
|
void |
setGenerateIsSetMethod(boolean generateIsSetMethod)
|
void |
setJaxbBinDir(File jaxbBinDir)
|
void |
setJaxbGenModel(JaxbGenModel jaxbGenModel)
|
void |
setJaxbPackageName(String jaxbPackageName)
The package name used for JAXB classes. |
void |
setJaxbRootClassNames(List<String> jaxbRootClassNames)
|
void |
setJaxbSrcDir(File jaxbSrcDir)
|
void |
setJsonTransformers(boolean jsonTransformers)
|
void |
setNoPackageInfo(boolean noPackageInfo)
Prevents generation of JAXB package-info.java which does not compile under JDK 1.5. |
void |
setSerializableUid(long serializableUid)
|
void |
setTypeNamePrefix(String typeNamePrefix)
|
void |
setTypeNameSuffix(String typeNameSuffix)
|
void |
setUnmarshalChoiceStrategies(List<UnmarshalChoiceStrategy> unmarshalChoiceStrategies)
Unmarshal choice strategies to inject in generated bindings. |
void |
setXmlTransformers(boolean xmlTransformers)
|
void |
setXsdFile(File xsdFile)
|
Properties |
toProperties()
|
protected List<String> |
toStringList(List<UnmarshalChoiceStrategy> unmarshalChoiceStrategies)
Helper to serialize the list unmarshal choice strategies to a properties file. |
protected List<UnmarshalChoiceStrategy> |
toUnmarshalChoiceStrategies(List<String> stringList)
Helper to deserialize a list of unmarshal choice strategies from a properties file. |
Methods inherited from class com.legstar.codegen.models.AbstractAntBuildModel |
---|
generateBuild, generateBuild, getProbeFile, getProductLocation, setProbeFile, setProductLocation |
Methods inherited from class com.legstar.codegen.models.AbstractPropertiesModel |
---|
getBoolean, getFile, getInt, getLong, getString, getStringList, getURI, putBoolean, putFile, putInt, putLong, putString, putStringList, putURI, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final String COXB_GENERATOR_NAME
public static final String COXB_VELOCITY_MACRO_NAME
public static final boolean DEFAULT_ISXMLTRANSFORMERS
public static final boolean DEFAULT_ISJSONTRANSFORMERS
public static final boolean DEFAULT_IS_COMPILE_TRANSFORMERS
public static final String DEFAULT_JAXB_PACKAGENAME
public static final String COXB_PACKAGENAME
public static final String COXB_JAXB_ALTERNATIVEFACTORYNAME
public static final String COXB_JAXB_ALTERNATIVEPACKAGENAME
public static final String COXB_ISJSONTRANSFORMERS
public static final String COXB_ISXMLTRANSFORMERS
public static final String COXB_IS_COMPILE_TRANSFORMERS
public static final String COXB_XSDFILE
public static final String COXB_JAXBROOTCLASSNAMES
public static final String COXB_JAXBSRCDIR
public static final String COXB_JAXBBINDIR
public static final String COXB_COXBSRCDIR
public static final String COXB_COXBBINDIR
public static final String COXB_UNMARSHAL_CHOICE_STRATEGIES
Constructor Detail |
---|
public CoxbGenModel()
public CoxbGenModel(Properties props)
props
- the property fileMethod Detail |
---|
public void generateBuild(File scriptFile) throws CodeGenMakeException
scriptFile
- the script file that must be created
CodeGenMakeException
- if generation failspublic void addJaxbRootClassName(String className)
className
- The JAXB root class name to set.public File getXsdFile()
public void setXsdFile(File xsdFile)
xsdFile
- the XML schema file to setpublic File getCoxbSrcDir()
public void setCoxbSrcDir(File targetDir)
targetDir
- the target directory to setpublic File getJaxbBinDir()
public void setJaxbBinDir(File jaxbBinDir)
jaxbBinDir
- the JAXB location to setpublic String getJaxbPackageName() throws CoxbGenException
CoxbGenException
- if pacakage could not le extracted from XML
schemapublic void setJaxbPackageName(String jaxbPackageName)
jaxbPackageName
- the JAXB classes package name to setpublic boolean isGenerateIsSetMethod()
public void setGenerateIsSetMethod(boolean generateIsSetMethod)
generateIsSetMethod
- if IsSet Methods should be generatedpublic long getSerializableUid()
public void setSerializableUid(long serializableUid)
serializableUid
- the serialization unique ID. (All JAXB classes
must be serializable for LegStar)public String getTypeNamePrefix()
public void setTypeNamePrefix(String typeNamePrefix)
typeNamePrefix
- the prefix to add to type namespublic String getTypeNameSuffix()
public void setTypeNameSuffix(String typeNameSuffix)
typeNameSuffix
- the suffix to add to type namespublic String getElementNamePrefix()
public void setElementNamePrefix(String elementNamePrefix)
elementNamePrefix
- the prefix to add to element namespublic String getElementNameSuffix()
public void setElementNameSuffix(String elementNameSuffix)
elementNameSuffix
- the suffix to add to element namespublic boolean isEciCompatible()
public void setEciCompatible(boolean eciCompatible)
eciCompatible
- whether the ECI naming conventions should be usedpublic boolean isNoPackageInfo()
public void setNoPackageInfo(boolean noPackageInfo)
noPackageInfo
- true if we should not generate package-info.javapublic String getCoxbPackageName() throws CoxbGenException
CoxbGenException
- if package name cannot be extracted from XML
Schemapublic void setCoxbPackageName(String coxbPackageName)
coxbPackageName
- package name for generated binding classes to setpublic String getAlternativePackageName()
public void setAlternativePackageName(String alternativePackageName)
alternativePackageName
- the optional runtime alternative to the
Jaxb package name used at generation timepublic String getAlternativeFactoryName()
public void setAlternativeFactoryName(String targetFactoryName)
targetFactoryName
- the alternate factory to used rather than the
JAXB onepublic File getJaxbSrcDir()
public void setJaxbSrcDir(File jaxbSrcDir)
jaxbSrcDir
- the location where JAXB classes sources live to setpublic List<String> getJaxbRootClassNames()
public void setJaxbRootClassNames(List<String> jaxbRootClassNames)
jaxbRootClassNames
- the set of Jaxb root class names to generated
binding classes for to setpublic File getCoxbBinDir()
public void setCoxbBinDir(File coxbBinDir)
coxbBinDir
- the target directory where binary files will be created
to setpublic JaxbGenModel getJaxbGenModel()
public void setJaxbGenModel(JaxbGenModel jaxbGenModel)
jaxbGenModel
- the JAXB binding customization to setpublic boolean isXmlTransformers()
public void setXmlTransformers(boolean xmlTransformers)
xmlTransformers
- true if Host to XML transformers generation is
turned onpublic boolean isJsonTransformers()
public void setJsonTransformers(boolean jsonTransformers)
jsonTransformers
- true if Host to JSON transformers generation is
turned onpublic boolean isCompileTransformers()
public void setCompileTransformers(boolean compileTransformers)
compileTransformers
- true if transformers compilation is turned onpublic List<UnmarshalChoiceStrategy> getUnmarshalChoiceStrategies()
public void setUnmarshalChoiceStrategies(List<UnmarshalChoiceStrategy> unmarshalChoiceStrategies)
unmarshalChoiceStrategies
- the unmarshal choice strategies to
inject in generated bindings to setpublic void addUnmarshalChoiceStrategy(UnmarshalChoiceStrategy unmarshalChoiceStrategy)
unmarshalChoiceStrategy
- a choice strategy to inject in generated
bindingspublic String getJaxbPackageNameFromXsd(File xsdFile) throws CoxbGenException
xsdFile
- the XML schema file
CoxbGenException
- if package name cannot be retrieved from XSDpublic String getJaxbClassIncludes() throws CoxbGenException
CoxbGenException
- if JAXB pacakge name does not existprotected DocumentBuilder getDocBuilder() throws CoxbGenException
CoxbGenException
- if DOM builder cannot be createdpublic Properties toProperties()
toProperties
in class AbstractAntBuildModel
protected List<String> toStringList(List<UnmarshalChoiceStrategy> unmarshalChoiceStrategies)
unmarshalChoiceStrategies
- the list of unmarshal choice strategies
protected List<UnmarshalChoiceStrategy> toUnmarshalChoiceStrategies(List<String> stringList)
stringList
- a list of strings
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |