org.jibx.runtime
Class BindingDirectory

java.lang.Object
  extended by org.jibx.runtime.BindingDirectory

public abstract class BindingDirectory
extends Object

Abstract class with static methods to find the binding factory corresponding to a binding name.

Author:
Dennis M. Sosnoski

Field Summary
static String BINDINGFACTORY_SUFFIX
          Suffix of binding factory name.
static String BINDINGLIST_NAME
          Name of String[] field giving binding factory name list.
static Class[] EMPTY_ARGS
          Empty argument list.
static String FACTORY_INSTMETHOD
          Binding factory method to get instance of factory.
static String GENERATE_PREFIX
          Prefix used in all code generation for methods and classes.
 
Constructor Summary
BindingDirectory()
           
 
Method Summary
static String convertName(String name)
          Generate binding name.
static IBindingFactory getFactory(Class clas)
          Get instance of binding factory.
static IBindingFactory getFactory(String name, Class clas)
          Get instance of binding factory.
static IBindingFactory getFactory(String name, Class clas, ClassLoader loader)
          Get instance of binding factory.
static IBindingFactory getFactory(String bname, String pack)
          Get instance of binding factory.
static IBindingFactory getFactory(String bname, String pack, ClassLoader loader)
          Get instance of binding factory.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BINDINGLIST_NAME

public static final String BINDINGLIST_NAME
Name of String[] field giving binding factory name list.

See Also:
Constant Field Values

GENERATE_PREFIX

public static final String GENERATE_PREFIX
Prefix used in all code generation for methods and classes.

See Also:
Constant Field Values

BINDINGFACTORY_SUFFIX

public static final String BINDINGFACTORY_SUFFIX
Suffix of binding factory name.

See Also:
Constant Field Values

FACTORY_INSTMETHOD

public static final String FACTORY_INSTMETHOD
Binding factory method to get instance of factory.

See Also:
Constant Field Values

EMPTY_ARGS

public static final Class[] EMPTY_ARGS
Empty argument list.

Constructor Detail

BindingDirectory

public BindingDirectory()
Method Detail

getFactory

public static IBindingFactory getFactory(String name,
                                         Class clas,
                                         ClassLoader loader)
                                  throws JiBXException
Get instance of binding factory. Finds the binding factory for the named binding on the target class, then loads that factory and returns an instance.

Parameters:
name - binding name
clas - target class for binding
loader - class loader to be used for loading factory
Returns:
binding factory instance
Throws:
JiBXException - on any error in finding or accessing factory

getFactory

public static IBindingFactory getFactory(String name,
                                         Class clas)
                                  throws JiBXException
Get instance of binding factory. Finds the binding factory for the named binding on the target class, then loads that factory and returns an instance.

Parameters:
name - binding name
clas - target class for binding
Returns:
binding factory instance
Throws:
JiBXException - on any error in finding or accessing factory

getFactory

public static IBindingFactory getFactory(Class clas)
                                  throws JiBXException
Get instance of binding factory. Finds the binding factory for the target class, then loads that factory and returns an instance. This method can only be used with target classes that are mapped in only one binding.

Parameters:
clas - target class for binding
Returns:
binding factory instance
Throws:
JiBXException - on any error in finding or accessing factory

getFactory

public static IBindingFactory getFactory(String bname,
                                         String pack,
                                         ClassLoader loader)
                                  throws JiBXException
Get instance of binding factory. Finds the binding factory for the named binding on the target class, then loads that factory and returns an instance.

Parameters:
bname - binding name
pack - target package for binding
loader - class loader to be used for loading factory
Returns:
binding factory instance
Throws:
JiBXException - on any error in finding or accessing factory

getFactory

public static IBindingFactory getFactory(String bname,
                                         String pack)
                                  throws JiBXException
Get instance of binding factory. Finds the binding factory for the named binding compiled to the specified package, then loads that factory and returns an instance.

Parameters:
bname - binding name
pack - target package for binding
Returns:
binding factory instance
Throws:
JiBXException - on any error in finding or accessing factory

convertName

public static String convertName(String name)
Generate binding name. This takes a base name (such as a file name with extension stripped off) and converts it to legal form by substituting '_' characters for illegal characters in the base name.

Parameters:
name - base binding name
Returns:
converted binding name


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