com.legstar.jaxb.gen
Class CobolJAXBGenerator

java.lang.Object
  extended by org.apache.tools.ant.ProjectComponent
      extended by org.apache.tools.ant.Task
          extended by com.legstar.jaxb.gen.CobolJAXBGenerator

public class CobolJAXBGenerator
extends org.apache.tools.ant.Task

A lightweight ant Task which augments the standard JAXB XJC Task.

The basic idea is to collect customization parameters and generate a temporary JAXB external customization file.

This is not a replacement for XJC, just a more restricted way of using it for legstar to relieve upfront modules, such as cob2xsd, from adding JAXB customizations to the XML SChema.


Field Summary
 
Fields inherited from class org.apache.tools.ant.Task
description, location, target, taskName, taskType, wrapper
 
Fields inherited from class org.apache.tools.ant.ProjectComponent
project
 
Constructor Summary
CobolJAXBGenerator()
          No args constructor.
CobolJAXBGenerator(JaxbGenModel context)
          Constructor from a set of options.
 
Method Summary
protected  void checkInput()
          Checks that properties set are valid.
 String createExternalCustomization(File xsdFile)
          Creates a temporary binding file holding the parameters chosen.
protected  File createInternalCustomization(File xsdFile)
          Creates a temporary XML Schema which holds JAXB customization bindings.
 void execute()
          The ant method.
 String getElementNamePrefix()
          The prefix to add to element names.
 String getElementNameSuffix()
          The suffix to add to element names.
 String getJaxbPackageName()
          If specified, generated code will be placed under this Java package.
 long getSerializableUid()
          The serialization unique ID.
 File getTargetDir()
          Generated code will be written under this directory.
 String getTypeNamePrefix()
          The prefix to add to type names.
 String getTypeNameSuffix()
          The suffix to add to type names.
 File getXsdFile()
          This is the schema file to be compiled.
 void init()
          Initialize a commons logging logger so that XJC logs gets merged with the legstar ones.
 boolean isEciCompatible()
          Whether the ECI naming conventions should be used.
 boolean isGenerateIsSetMethod()
          If IsSet Methods should be generated.
 boolean isInternalBindings()
          whether internal bindings or and external binding should be used.
 boolean isNoPackageInfo()
          Prevents generation of JAXB package-info.java which does not compile under JDK 1.5.
 void setEciCompatible(boolean eciCompatible)
          Whether the ECI naming conventions should be used.
 void setElementNamePrefix(String elementNamePrefix)
          The prefix to add to element names.
 void setElementNameSuffix(String elementNameSuffix)
          The suffix to add to element names.
 void setGenerateIsSetMethod(boolean generateIsSetMethod)
          If IsSet Methods should be generated.
 void setInternalBindings(boolean internalBindings)
          Whether internal bindings or and external binding should be used.
 void setJaxbPackageName(String jaxbPackageName)
          If specified, generated code will be placed under this Java package.
 void setNoPackageInfo(boolean noPackageInfo)
          Prevents generation of JAXB package-info.java which does not compile under JDK 1.5.
 void setSerializableUid(long serializableUid)
          The serialization unique ID.
 void setTargetDir(File targetDir)
          Generated code will be written under this directory.
 void setTypeNamePrefix(String typeNamePrefix)
          The prefix to add to type names.
 void setTypeNameSuffix(String typeNameSuffix)
          The suffix to add to type names.
 void setXsdFile(File xsdFile)
          This is the schema file to be compiled.
 
Methods inherited from class org.apache.tools.ant.Task
getDescription, getLocation, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, isInvalid, log, log, maybeConfigure, perform, reconfigure, setDescription, setLocation, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType
 
Methods inherited from class org.apache.tools.ant.ProjectComponent
getProject, setProject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CobolJAXBGenerator

public CobolJAXBGenerator()
No args constructor.


CobolJAXBGenerator

public CobolJAXBGenerator(JaxbGenModel context)
Constructor from a set of options.

Parameters:
context - options set
Method Detail

init

public void init()
Initialize a commons logging logger so that XJC logs gets merged with the legstar ones.

Overrides:
init in class org.apache.tools.ant.Task
See Also:
Task.init()

execute

public void execute()
The ant method. Generates JAXB classes by invoking XJC.

Overrides:
execute in class org.apache.tools.ant.Task

checkInput

protected void checkInput()
Checks that properties set are valid.


createInternalCustomization

protected File createInternalCustomization(File xsdFile)
Creates a temporary XML Schema which holds JAXB customization bindings.

Parameters:
xsdFile - the original XML schema file
Returns:
the customized XML Schema file

createExternalCustomization

public String createExternalCustomization(File xsdFile)
Creates a temporary binding file holding the parameters chosen.

Parameters:
xsdFile - the XML Schema location
Returns:
the location of the temporary XJB file

getXsdFile

public File getXsdFile()
This is the schema file to be compiled. A file name (can be relative to the build script base directory), or absolute.

Returns:
the schema file

setXsdFile

public void setXsdFile(File xsdFile)
This is the schema file to be compiled. A file name (can be relative to the build script base directory), or absolute.

Parameters:
xsdFile - schema file

getJaxbPackageName

public String getJaxbPackageName()
If specified, generated code will be placed under this Java package.

Returns:
Java package name

setJaxbPackageName

public void setJaxbPackageName(String jaxbPackageName)
If specified, generated code will be placed under this Java package.

Parameters:
jaxbPackageName - Java package name

getTargetDir

public File getTargetDir()
Generated code will be written under this directory.

Returns:
destination directory

setTargetDir

public void setTargetDir(File targetDir)
Generated code will be written under this directory.

Parameters:
targetDir - destination directory

isGenerateIsSetMethod

public boolean isGenerateIsSetMethod()
If IsSet Methods should be generated.

Returns:
if IsSet Methods should be generated

setGenerateIsSetMethod

public void setGenerateIsSetMethod(boolean generateIsSetMethod)
If IsSet Methods should be generated.

Parameters:
generateIsSetMethod - if IsSet Methods should be generated

getSerializableUid

public long getSerializableUid()
The serialization unique ID. (All JAXB classes must be serializable for LegStar).

Returns:
the serialization unique ID. (All JAXB classes must be serializable for LegStar)

setSerializableUid

public void setSerializableUid(long serializableUid)
The serialization unique ID. (All JAXB classes must be serializable for LegStar).

Parameters:
serializableUid - the serialization unique ID. (All JAXB classes must be serializable for LegStar)

getTypeNamePrefix

public String getTypeNamePrefix()
The prefix to add to type names.

Returns:
the prefix to add to type names

setTypeNamePrefix

public void setTypeNamePrefix(String typeNamePrefix)
The prefix to add to type names.

Parameters:
typeNamePrefix - the prefix to add to type names

getTypeNameSuffix

public String getTypeNameSuffix()
The suffix to add to type names.

Returns:
the suffix to add to type names

setTypeNameSuffix

public void setTypeNameSuffix(String typeNameSuffix)
The suffix to add to type names.

Parameters:
typeNameSuffix - the suffix to add to type names

getElementNamePrefix

public String getElementNamePrefix()
The prefix to add to element names.

Returns:
the prefix to add to element names

setElementNamePrefix

public void setElementNamePrefix(String elementNamePrefix)
The prefix to add to element names.

Parameters:
elementNamePrefix - the prefix to add to element names

getElementNameSuffix

public String getElementNameSuffix()
The suffix to add to element names.

Returns:
the suffix to add to element names

setElementNameSuffix

public void setElementNameSuffix(String elementNameSuffix)
The suffix to add to element names.

Parameters:
elementNameSuffix - the suffix to add to element names

isInternalBindings

public boolean isInternalBindings()
whether internal bindings or and external binding should be used.

Returns:
whether internal bindings or and external binding should be used

setInternalBindings

public void setInternalBindings(boolean internalBindings)
Whether internal bindings or and external binding should be used.

Parameters:
internalBindings - whether internal bindings or and external binding should be used

isEciCompatible

public boolean isEciCompatible()
Whether the ECI naming conventions should be used.

Returns:
Whether the ECI naming conventions should be used

setEciCompatible

public void setEciCompatible(boolean eciCompatible)
Whether the ECI naming conventions should be used.

Parameters:
eciCompatible - whether the ECI naming conventions should be used

isNoPackageInfo

public boolean isNoPackageInfo()
Prevents generation of JAXB package-info.java which does not compile under JDK 1.5.

Returns:
true if we should not generate package-info.java

setNoPackageInfo

public void setNoPackageInfo(boolean noPackageInfo)
Prevents generation of JAXB package-info.java which does not compile under JDK 1.5.

Parameters:
noPackageInfo - true if we should not generate package-info.java


Copyright © 2015 LegSem. All Rights Reserved.