|
||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||
java.lang.Objectorg.jibx.binding.generator.BindGen
public class BindGen
Binding generator implementation.
| Field Summary | |
|---|---|
private BindingOrganizer |
m_directory
Directory for bindings being built. |
private java.util.Set |
m_directSet
Set of class names to be handled directly. |
private java.util.Map |
m_elementNamesMap
Map from namespace URI to UniqueNameSet for element names. |
private java.util.Set |
m_formatSet
Set of class names possibly requiring format definitions. |
private GlobalCustom |
m_global
Binding generation customizations. |
private java.util.Set |
m_ignoreSet
Set of class names to be ignored. |
private java.util.Set |
m_includeSet
Set of class names to be included. |
private java.util.Map |
m_mappingDetailsMap
Map from fully-qualified class name to mapping details. |
private java.util.Set |
m_superSet
Set of class names subclassed by other classes in binding. |
private java.lang.String |
m_targetPackage
Target package for binding code generation. |
private java.util.Map |
m_typeNamesMap
Map from namespace URI to UniqueNameSet for type names. |
| Constructor Summary | |
|---|---|
BindGen(GlobalCustom glob)
Create a generator based on a particular set of customizations. |
|
| Method Summary | |
|---|---|
private void |
addMapping(java.lang.String type,
BindingMappingDetail detail)
Add the <mapping> definition for a class to a binding. |
private BindingMappingDetail |
addMappingDetails(java.lang.Boolean abstr,
QName ename,
java.lang.String type)
Add the details for mapping a class. |
private void |
addMemberBindings(ClassCustom cust,
java.util.Map exmethmap,
java.util.Map inmethmap,
NestingElementBase parent,
BindingHolder hold)
Add binding details for the actual members of a class, excluding any members which have been handled separately. |
private void |
addReferencedMappings(ReferenceCountMap refmap)
Add mapping details for classes referenced more than once, or classes with mapping forced. |
boolean |
checkInclude(java.lang.String type)
Check if a class needs to be included in the binding. |
private MappingElement |
createMapping(java.lang.String type,
ClassCustom cust)
Create and initialize a <mapping> element. |
void |
defineCollection(java.lang.String itype,
java.lang.String iname,
CollectionElement coll,
BindingHolder hold)
Define the details of a collection binding. |
void |
expandReferences(java.lang.String type,
ReferenceCountMap refmap)
Expand all references from a class. |
private void |
fillStructure(ClassCustom cust,
ValueCustom memb,
java.util.Map inmethmap,
StructureElement struct,
BindingHolder hold)
Add binding details for the full representation of a class. |
BindingHolder |
findBinding(java.lang.String uri)
Find the binding to be used for a particular namespace. |
private void |
findReferences(java.util.List classes,
ReferenceCountMap refmap)
Find closure of references from a supplied list of classes. |
BindingHolder |
finish(java.lang.String name,
java.lang.String[] adduris)
Complete the generated bindings. |
private void |
fixBaseClasses()
Fix the base classes that are to be used as extension types. |
private QName |
fixElementName(QName qname)
Fix element local name to be unique within the appropriate namespace. |
private QName |
fixQName(QName qname,
java.util.Map map)
Fix local name to be unique within the appropriate namespace for a category of names. |
private QName |
fixTypeName(QName qname)
Fix type local name to be unique within the appropriate namespace. |
private void |
flagMultipleReferences(ReferenceCountMap refmap)
Flag classes referenced more than once to be handled with <mapping> definitions. |
void |
generate(java.lang.Boolean abstr,
java.util.List classes)
Generate binding(s) for a list of classes. |
private void |
generateFormats()
Generate any required format definitions. |
private void |
generateMappings(java.util.List classes)
Generate mappings for a list of classes. |
private void |
generateReferencedMappings(ReferenceCountMap refmap)
Generate the mapping definitions for classes referenced more than once. |
void |
generateSpecified(java.util.ArrayList qnames,
java.util.List concrs,
java.util.List abstrs)
Generate binding(s) for lists of classes. |
BindingHolder |
getBinding(java.lang.String uri)
Get the binding definition for a namespace. |
BindingMappingDetail |
getMappingDetail(java.lang.String type)
Get the mapping details for a class. |
java.util.ArrayList |
getNamespaces()
Get the list of binding namespace URIs. |
private boolean |
isQNameUsed(QName qname,
java.util.Map map)
Check if a qualified name is already defined within a category of names. |
boolean |
isValueClass(java.lang.String type)
Check if a class represents a simple value. |
static void |
main(java.lang.String[] args)
Run the binding generation using command line parameters. |
private void |
setTypes(ValueCustom memb,
StructureElementBase struct)
Set creation information for structure binding component. |
java.util.List |
validateFiles(java.io.File dir,
IClassLocator loc,
BindingHolder root)
Write and validate the generated binding definition files. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private final GlobalCustom m_global
private final java.util.Set m_includeSet
private final java.util.Set m_ignoreSet
private final java.util.Set m_directSet
private final java.util.Set m_superSet
private final java.util.Set m_formatSet
private final java.util.Map m_mappingDetailsMap
private final java.util.Map m_typeNamesMap
UniqueNameSet for type names.
private final java.util.Map m_elementNamesMap
UniqueNameSet for element names.
private java.lang.String m_targetPackage
private BindingOrganizer m_directory
| Constructor Detail |
|---|
public BindGen(GlobalCustom glob)
glob - | Method Detail |
|---|
public boolean isValueClass(java.lang.String type)
type - fully qualified class name
true if simple value, false if notpublic boolean checkInclude(java.lang.String type)
true if any member is ultimately found with a simple value.
type - fully qualified class name
true if class to be included in binding, false if it should be skipped
public void expandReferences(java.lang.String type,
ReferenceCountMap refmap)
type - fully qualified class namerefmap - reference count map
private void setTypes(ValueCustom memb,
StructureElementBase struct)
memb - struct -
public void defineCollection(java.lang.String itype,
java.lang.String iname,
CollectionElement coll,
BindingHolder hold)
itype - item typeiname - item namecoll - hold -
private void addMemberBindings(ClassCustom cust,
java.util.Map exmethmap,
java.util.Map inmethmap,
NestingElementBase parent,
BindingHolder hold)
cust - class customization informationexmethmap - map from property method names to be excluded to the corresponding property customizationsinmethmap - map from property method names included in binding to the corresponding property customizations
(populated by this method, null if not needed)parent - containing binding componenthold - binding holder
private void fillStructure(ClassCustom cust,
ValueCustom memb,
java.util.Map inmethmap,
StructureElement struct,
BindingHolder hold)
cust - class customization informationmemb - member customization information (null if implicit reference, rather than member)inmethmap - map from property method names included in binding to the corresponding property customizations,
(needed in case of interface or overridden methods; populated by this method, null if not needed)struct - structure element referencing the classhold - binding holder
private void addMapping(java.lang.String type,
BindingMappingDetail detail)
type - fully qualified class namedetail - mapping details
private MappingElement createMapping(java.lang.String type,
ClassCustom cust)
type - cust -
private BindingMappingDetail addMappingDetails(java.lang.Boolean abstr,
QName ename,
java.lang.String type)
abstr - force abstract mapping flagename - element name for concrete mapping (null if unspecified)type - fully-qualified class name
private boolean isQNameUsed(QName qname,
java.util.Map map)
qname - requested qualified name (null allowed, always returns false)map - namespace URI to UniqueNameSet map for category
true if used, false if not
private QName fixQName(QName qname,
java.util.Map map)
qname - requested qualified name (null allowed, always returns null)map - namespace URI to UniqueNameSet map for category
private QName fixElementName(QName qname)
qname - requested qualified name (null allowed, always returns null)
private QName fixTypeName(QName qname)
qname - requested qualified name (null allowed, always returns null)
private void findReferences(java.util.List classes,
ReferenceCountMap refmap)
classes - refmap - private void flagMultipleReferences(ReferenceCountMap refmap)
refmap - private void addReferencedMappings(ReferenceCountMap refmap)
refmap - private void generateReferencedMappings(ReferenceCountMap refmap)
refmap - private void generateMappings(java.util.List classes)
classes - private void fixBaseClasses()
private void generateFormats()
public void generate(java.lang.Boolean abstr,
java.util.List classes)
abstr - force abstract mapping flag (use both abstract and concrete if null)classes - class list
public void generateSpecified(java.util.ArrayList qnames,
java.util.List concrs,
java.util.List abstrs)
qnames - list of names for concrete mappingsconcrs - list of classes to be given concrete mappingsabstrs - list of classes to be given abstract mappingspublic BindingMappingDetail getMappingDetail(java.lang.String type)
generate(Boolean, List) method has been called.
type - fully-qualified class name
null if nonepublic BindingHolder findBinding(java.lang.String uri)
BindingOrganizer implementation.
uri - namespace URI (null if no namespace)
public BindingHolder getBinding(java.lang.String uri)
generate(Boolean, List) method has been called. It delegates to the
BindingOrganizer implementation.
uri -
null if nonepublic java.util.ArrayList getNamespaces()
public BindingHolder finish(java.lang.String name,
java.lang.String[] adduris)
name - file name for root or singleton binding definitionadduris - list of namespaces to be added to bindings, if not already defined
public java.util.List validateFiles(java.io.File dir,
IClassLocator loc,
BindingHolder root)
throws java.io.IOException,
JiBXException
dir - target directory (bindings not written if null)loc - class locator for binding validation (ignored if no target directory supplied)root - holder for root binding definition
null if validation error
java.io.IOException
JiBXException
public static void main(java.lang.String[] args)
throws JiBXException,
java.io.IOException
args -
JiBXException
java.io.IOException
|
||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||