org.jibx.binding
Class BindingGenerator

java.lang.Object
  extended by 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
BindingGenerator()
          Default constructor.
BindingGenerator(boolean verbose, boolean mixed, String uri)
          Constructor with settings specified.
 
Method Summary
 String elementName(String cname)
          Generate structure element name from class name using set conversions.
static void findClassesUsed(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.
 BindingElement generate(ArrayList names, HashSet abstracts, HashMap customs, HashMap beans, HashMap enums, ArrayList ignores)
          Generate a set of bindings using supplied classpaths and class names.
static void main(String[] args)
          Main method for running compiler as application.
 void setCamelCase(boolean camel)
          Set control flag for camel case element naming.
 void setVerbose(boolean verbose)
          Set control flag for verbose processing reports.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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 results
mixed - use camel case in element names
uri - 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 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, and java.lang.Object. Exception classes thrown by the methods are also optionally accumulated.

Parameters:
cname - target class name
mnames - method names to be checked
dataset - 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)
Throws:
JiBXException - on error in loading class information

generate

public BindingElement generate(ArrayList names,
                               HashSet abstracts,
                               HashMap customs,
                               HashMap beans,
                               HashMap enums,
                               ArrayList ignores)
                        throws JiBXException
Generate a set of bindings using supplied classpaths and class names.

Parameters:
names - list of class names to be included in binding
abstracts - set of classes to be handled with abstract mappings in binding
customs - map of customized class names to marshaller/unmarshaller class names
beans - map of class names to supplied lists of properties
enums - map of typesafe enumeration classes to deserializer methods
ignores - list of non-interface classes to be treated as interfaces (no mapping, but mapped subclasses are used at runtime)
Throws:
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


Copyright © 2005-2011 jibx.org. All Rights Reserved.