public class BindingGenerator
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
private static java.lang.String |
CURRENT_VERSION
Generator version.
|
private java.util.HashMap |
m_beanNames
Class names to properties list map.
|
private java.util.HashMap |
m_enumerationNames
Class names to deserializers map for typesafe enumerations.
|
private java.util.HashSet |
m_ignoreNames
Class names to be treated like interfaces (not mapped directly).
|
private java.util.HashMap |
m_mappedNames
Class names to mapped element names map.
|
private boolean |
m_mixedCase
Use camel case for XML names flag.
|
private java.lang.String |
m_namespaceUri
Namespace URI for elements.
|
private java.util.HashSet |
m_structureNames
Class names bound as nested structures.
|
private ObjectStack |
m_structureStack
Stack of structure definitions in progress (used to detect cycles).
|
private boolean |
m_verbose
Show verbose output flag.
|
private static java.util.HashSet |
s_objectPrimitiveSet
Set of objects treated as primitives.
|
| Constructor and Description |
|---|
BindingGenerator()
Default constructor.
|
BindingGenerator(boolean verbose,
boolean mixed,
java.lang.String uri)
Constructor with settings specified.
|
| Modifier and Type | Method and Description |
|---|---|
private java.lang.String |
convertName(java.lang.String base)
Convert class or unprefixed field name to element or attribute name.
|
private MappingElementBase |
createMapping(ClassFile cf,
boolean abstr)
Create the mapping element for a particular class.
|
private StructureElement |
createStructure(ClassFile cf,
java.lang.String fname)
Create the structure element for a particular class.
|
private void |
defineFields(ClassFile cf,
ContainerElementBase contain)
Construct the list of child binding components that define the binding
structure for fields of a particular class.
|
private void |
defineProperties(ClassFile cf,
java.util.ArrayList props,
boolean internal,
ContainerElementBase contain)
Construct the list of child binding components that define the binding
structure corresponding to properties of a particular class.
|
private void |
defineStructure(ClassFile cf,
ContainerElementBase contain)
Construct the list of child binding components that define the binding
structure corresponding to a particular class.
|
java.lang.String |
elementName(java.lang.String cname)
Generate structure element name from class name using set conversions.
|
static void |
findClassesUsed(java.lang.String cname,
java.util.ArrayList mnames,
java.util.HashSet dataset,
java.util.HashSet exceptset)
Get the set of data classes passed to or returned by a list of methods
within a class.
|
BindingElement |
generate(java.util.ArrayList names,
java.util.HashSet abstracts,
java.util.HashMap customs,
java.util.HashMap beans,
java.util.HashMap enums,
java.util.ArrayList ignores)
Generate a set of bindings using supplied classpaths and class names.
|
private static boolean |
isMappable(java.lang.String cname) |
static void |
main(java.lang.String[] args)
Main method for running compiler as application.
|
private void |
nestingIndent(java.io.PrintStream pw)
Indent to proper depth for current item.
|
void |
setCamelCase(boolean camel)
Set control flag for camel case element naming.
|
void |
setVerbose(boolean verbose)
Set control flag for verbose processing reports.
|
private java.lang.String |
valueName(java.lang.String fname)
Generate structure element name from class name using set conversions.
|
private static java.lang.String CURRENT_VERSION
private static java.util.HashSet s_objectPrimitiveSet
private boolean m_verbose
private boolean m_mixedCase
private java.lang.String m_namespaceUri
private java.util.HashMap m_mappedNames
private java.util.HashMap m_beanNames
private java.util.HashMap m_enumerationNames
private ObjectStack m_structureStack
private java.util.HashSet m_structureNames
private java.util.HashSet m_ignoreNames
public BindingGenerator()
public BindingGenerator(boolean verbose,
boolean mixed,
java.lang.String uri)
verbose - report binding details and resultsmixed - use camel case in element namesuri - namespace URI for element bindingspublic void setVerbose(boolean verbose)
verbose - report verbose information in processing bindings flagpublic void setCamelCase(boolean camel)
camel - use camel case element naming flagprivate void nestingIndent(java.io.PrintStream pw)
pw - output print stream to be indentedprivate java.lang.String convertName(java.lang.String base)
base - class or simple field name to be convertedpublic java.lang.String elementName(java.lang.String cname)
cname - class name to be convertedprivate java.lang.String valueName(java.lang.String fname)
fname - field name to be convertedprivate void defineFields(ClassFile cf, ContainerElementBase contain) throws JiBXException
cf - class informationcontain - binding structure container elementJiBXException - on error in binding generationprivate void defineProperties(ClassFile cf, java.util.ArrayList props, boolean internal, ContainerElementBase contain) throws JiBXException
cf - class informationprops - list of properties specified for classinternal - allow private get/set methods flagcontain - binding structure container elementJiBXException - on error in binding generationprivate void defineStructure(ClassFile cf, ContainerElementBase contain) throws JiBXException
cf - class informationcontain - binding structure container elementJiBXException - on error in binding generationprivate StructureElement createStructure(ClassFile cf, java.lang.String fname) throws JiBXException
cf - class informationfname - name of field supplying referenceJiBXException - on error in binding generationprivate MappingElementBase createMapping(ClassFile cf, boolean abstr) throws JiBXException
cf - class informationabstr - force abstract mapping flagJiBXException - on error in binding generationprivate static boolean isMappable(java.lang.String cname)
public static void findClassesUsed(java.lang.String cname,
java.util.ArrayList mnames,
java.util.HashSet dataset,
java.util.HashSet exceptset)
throws JiBXException
java.lang.String, and java.lang.Object.
Exception classes thrown by the methods are also optionally accumulated.cname - target class namemnames - method names to be checkeddataset - set for accumulation of data classes (optional, data
classes not recorded if null)exceptset - set for accumulation of exception classes (optional,
data classes not recorded if null)JiBXException - on error in loading class informationpublic BindingElement generate(java.util.ArrayList names, java.util.HashSet abstracts, java.util.HashMap customs, java.util.HashMap beans, java.util.HashMap enums, java.util.ArrayList ignores) throws JiBXException
names - list of class names to be included in bindingabstracts - set of classes to be handled with abstract mappings in
bindingcustoms - map of customized class names to marshaller/unmarshaller
class namesbeans - map of class names to supplied lists of propertiesenums - map of typesafe enumeration classes to deserializer methodsignores - list of non-interface classes to be treated as interfaces
(no mapping, but mapped subclasses are used at runtime)JiBXException - if error in generating the binding definitionpublic static void main(java.lang.String[] args)
args - command line arguments