Package org.jibx.binding
Class BindingGenerator
- java.lang.Object
-
- org.jibx.binding.BindingGenerator
-
public class BindingGenerator extends Object
Binding generator. This loads the specified input classes and processes them to generate a default binding definition.- Author:
- Dennis M. Sosnoski
-
-
Constructor Summary
Constructors Constructor Description BindingGenerator()Default constructor.BindingGenerator(boolean verbose, boolean mixed, String uri)Constructor with settings specified.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description StringelementName(String cname)Generate structure element name from class name using set conversions.static voidfindClassesUsed(String cname, ArrayList mnames, HashSet dataset, HashSet exceptset)Get the set of data classes passed to or returned by a list of methods within a class.BindingElementgenerate(ArrayList names, HashSet abstracts, HashMap customs, HashMap beans, HashMap enums, ArrayList ignores)Generate a set of bindings using supplied classpaths and class names.static voidmain(String[] args)Main method for running compiler as application.voidsetCamelCase(boolean camel)Set control flag for camel case element naming.voidsetVerbose(boolean verbose)Set control flag for verbose processing reports.
-
-
-
Constructor Detail
-
BindingGenerator
public BindingGenerator()
Default constructor. This just initializes all options disabled.
-
BindingGenerator
public BindingGenerator(boolean verbose, boolean mixed, String uri)Constructor with settings specified.- Parameters:
verbose- report binding details and resultsmixed- use camel case in element namesuri- namespace URI for element bindings
-
-
Method Detail
-
setVerbose
public void setVerbose(boolean verbose)
Set control flag for verbose processing reports.- Parameters:
verbose- report verbose information in processing bindings flag
-
setCamelCase
public void setCamelCase(boolean camel)
Set control flag for camel case element naming.- Parameters:
camel- use camel case element naming flag
-
elementName
public String elementName(String cname)
Generate structure element name from class name using set conversions.- Parameters:
cname- class name to be converted- Returns:
- element name for instances of class
-
findClassesUsed
public static void findClassesUsed(String cname, ArrayList mnames, HashSet dataset, HashSet exceptset) throws org.jibx.runtime.JiBXException
Get the set of data classes passed to or returned by a list of methods within a class. The classes returned exclude primitive types, wrappers,java.lang.String, andjava.lang.Object. Exception classes thrown by the methods are also optionally accumulated.- Parameters:
cname- target class namemnames- method names to be checkeddataset- set for accumulation of data classes (optional, data classes not recorded ifnull)exceptset- set for accumulation of exception classes (optional, data classes not recorded ifnull)- Throws:
org.jibx.runtime.JiBXException- on error in loading class information
-
generate
public BindingElement generate(ArrayList names, HashSet abstracts, HashMap customs, HashMap beans, HashMap enums, ArrayList ignores) throws org.jibx.runtime.JiBXException
Generate a set of bindings using supplied classpaths and class names.- Parameters:
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)- Returns:
- BindingElement
- Throws:
org.jibx.runtime.JiBXException- if error in generating the binding definition
-
main
public static void main(String[] args)
Main method for running compiler as application.- Parameters:
args- command line arguments
-
-