Package org.jibx.runtime
Class BindingDirectory
java.lang.Object
org.jibx.runtime.BindingDirectory
Abstract class with static methods to find the binding factory corresponding
to a binding name.
- Author:
- Dennis M. Sosnoski
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
Suffix of binding factory name.static final String
Name ofString[]
field giving binding factory name list.static final Class[]
Empty argument list.static final String
Binding factory method to get instance of factory.static final String
Prefix used in all code generation for methods and classes. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic String
convertName
(String name) Generate binding name.private static String
getBindingList
(Class clas) Get list of bindings for class.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.private static IBindingFactory
getFactoryFromName
(String name, Class clas, ClassLoader loader) Get instance of factory.
-
Field Details
-
BINDINGLIST_NAME
Name ofString[]
field giving binding factory name list.- See Also:
-
GENERATE_PREFIX
Prefix used in all code generation for methods and classes.- See Also:
-
BINDINGFACTORY_SUFFIX
Suffix of binding factory name.- See Also:
-
FACTORY_INSTMETHOD
Binding factory method to get instance of factory.- See Also:
-
EMPTY_ARGS
Empty argument list.
-
-
Constructor Details
-
BindingDirectory
public BindingDirectory()
-
-
Method Details
-
getBindingList
Get list of bindings for class. This just accesses the static variable added to each class with a top-level mapping.- Parameters:
clas
- class with top-level mapping in binding- Returns:
- list of bindings defined for that class (as a text string)
- Throws:
JiBXException
- on error accessing binding information
-
getFactoryFromName
private static IBindingFactory getFactoryFromName(String name, Class clas, ClassLoader loader) throws JiBXException Get instance of factory. Loads the factory class using the classloader for the supplied class, then calls the get instance method of the factory class.- Parameters:
name
- fully qualified name of factory classclas
- class providing factoryloader
- class loader to be used for loading factory- Returns:
- binding factory instance
- Throws:
JiBXException
- on error loading or accessing factory
-
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 nameclas
- target class for bindingloader
- class loader to be used for loading factory- Returns:
- binding factory instance
- Throws:
JiBXException
- on any error in finding or accessing factory
-
getFactory
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 nameclas
- target class for binding- Returns:
- binding factory instance
- Throws:
JiBXException
- on any error in finding or accessing factory
-
getFactory
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 namepack
- target package for bindingloader
- class loader to be used for loading factory- Returns:
- binding factory instance
- Throws:
JiBXException
- on any error in finding or accessing factory
-
getFactory
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 namepack
- target package for binding- Returns:
- binding factory instance
- Throws:
JiBXException
- on any error in finding or accessing factory
-
convertName
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
-