public class CodeGen extends Object
public access,
they are intended for use only by the JiBX developers and may change from one release to the next. To make use of
this class from your own code, call the main(String[]) method with an appropriate argument list.| Constructor and Description |
|---|
CodeGen(SchemasetCustom global,
URL root,
File target)
Constructor.
|
CodeGen(SchemasetCustom custom,
ValidationContext vctx)
Constructor used by tests.
|
| Modifier and Type | Method and Description |
|---|---|
void |
applyAndNormalize()
Apply extensions and normalize all schemas.
|
String |
buildDataModel(boolean verbose,
boolean usenns,
Map elemmap,
Map typemap)
Generate the data model.
|
static boolean |
checkNoNamespace(BindingElement binding)
Check if a binding definition uses the no-namespace namespace.
|
boolean |
customizeSchemas(String pack,
ProblemHandler handler)
Validate and apply customizations to loaded schemas.
|
static List |
findPathSteps(File file)
Find the steps in the canonical path to a file.
|
SchemasetCustom |
findSchemaset(SchemaElement schema,
SchemasetCustom custom)
Find the most specific schemaset owning a schema.
|
boolean |
generate(boolean verbose,
String usens,
String dfltpkg,
String bindname,
List fileset,
List inclpaths,
File model,
ProblemHandler handler)
Generate code from a list of schemas.
|
BindingOrganizer |
getBindingDirectory()
Get the binding directory.
|
PackageOrganizer |
getPackageDirectory()
Get the package directory used for code generation.
|
BindingElement |
getRootBinding()
Get the root binding definition.
|
ValidationContext |
getSchemaValidationContext()
Get the validation context used for processing schemas.
|
static void |
main(String[] args)
Run the binding generation using command line parameters.
|
static BindingElement |
processPregeneratedBinding(URL url,
Map elemmap,
Map typemap,
ProblemHandler handler)
Load and validate binding and process all format and mapping definitions, including those in included bindings.
|
void |
pruneDefinitions()
Processes the schemas to remove unused global definitions.
|
static String |
relativeFilePath(File dir,
File file)
Construct a relative file path.
|
void |
setDefaultPrefixes(Iterator iter)
Scan schemas to find the default prefixes used for namespaces.
|
void |
writeBindings(String name,
String pack,
List pregens,
ProblemHandler handler)
Write the binding definitions file(s).
|
public CodeGen(SchemasetCustom global, URL root, File target)
global - schema customization root elementroot - URL for base of schema pathstarget - destination directory for code generationpublic CodeGen(SchemasetCustom custom, ValidationContext vctx)
custom - vctx - public ValidationContext getSchemaValidationContext()
public SchemasetCustom findSchemaset(SchemaElement schema, SchemasetCustom custom)
schema - custom - schema set customizationnull if nonepublic void setDefaultPrefixes(Iterator iter)
iter - schema iteratorpublic boolean customizeSchemas(String pack, ProblemHandler handler)
pack - package to be used by default for no-namespaced schemas (non-null)handler - validation problem handlertrue if successful, false if errorpublic void applyAndNormalize()
public void pruneDefinitions()
public String buildDataModel(boolean verbose, boolean usenns, Map elemmap, Map typemap)
verbose - verbose output flagusenns - no-namespace namespace used flagtypemap - map from qualified name of type (or attributeGroup, or group) to pregenerated mapping definitionelemmap - map from qualified name of element to pregenerated mapping definitionpublic BindingOrganizer getBindingDirectory()
public void writeBindings(String name, String pack, List pregens, ProblemHandler handler) throws JiBXException, IOException
buildDataModel(boolean, boolean, Map, Map) is called.name - root binding definition file name (use customization, or default, if null)pack - target package for binding (null if unspecified)pregens - pregenerated bindings to be included in root bindinghandler - validation error and code generation problem handlerJiBXExceptionIOExceptionpublic BindingElement getRootBinding()
writeBindings(String, String, List, ProblemHandler).public PackageOrganizer getPackageDirectory()
public boolean generate(boolean verbose,
String usens,
String dfltpkg,
String bindname,
List fileset,
List inclpaths,
File model,
ProblemHandler handler)
throws JiBXException,
IOException
verbose - verbose output flagusens - namespace to be used when no schemas with namespaces are being generated (null if not
specified)dfltpkg - default package for no-namespace schemas (null if not specified)bindname - name for root binding (null if not specified)fileset - list of resolvers for schemas to be generatedinclpaths - list of paths for bindings to be used for matching schema definitions (empty if none)model - file to be used for dumping generated data model (null if none)handler - validation error and code generation problem handlertrue if successful, false if failureJiBXExceptionIOExceptionpublic static BindingElement processPregeneratedBinding(URL url, Map elemmap, Map typemap, ProblemHandler handler) throws JiBXException, IOException
url - binding definition pathelemmap - map from element qualified name to class datatypemap - map from type qualified name to class datahandler - validation error and problem handlerJiBXExceptionIOExceptionpublic static List findPathSteps(File file) throws IOException
file - IOExceptionpublic static String relativeFilePath(File dir, File file) throws IOException
dir - start directory for pathfile - supplied file pathIOExceptionpublic static boolean checkNoNamespace(BindingElement binding)
binding - true if no-namespace namespace used, false if notCopyright © 2005-2014 jibx.org. All Rights Reserved.