JBoss XML Binding 2.0.3.GA-redhat-2

org.jboss.xb.builder
Class JBossXBBuilder

java.lang.Object
  extended by org.jboss.xb.builder.JBossXBBuilder

public class JBossXBBuilder
extends Object

JBossXBBuilder. Builds instances SchemaBinding for passed in classes by parsing binding annotations. By default, built instances of SchemaBinding are cached in the instances of ClassInfo. There are methods though that allow to re-build the cached bindings. Whether SequenceBinding or UnorderedSequenceBinding is used as the default for sequences is controlled by static property useUnorderedSequence. The value can be set by calling static method setUseUnorderedSequence(boolean value) or by setting system property xb.builder.useUnorderedSequence to true or false. The initialization fro the system property happens once in the static initializer.

Version:
$Revision: 1.1 $
Author:
Adrian Brock

Field Summary
static String ELEMENT_SET_PARENT_OVERRIDE_HANDLER
          system property name to use for initialization General purpose handlers in setParent do a map.get(QName) to find the correct property handler to add the child to the parent.
static String REPEATABLE_PARTICLE_HANDLERS
          system property name to use for initialization Used for collection or array properties.
static String SEQUENCES_REQUIRE_PROP_ORDER
          system property name to use for initialization whether to enforce the presence of propOrder in XmlType annotation when content of the type is bound to a sequence
static String USE_UNORDERED_SEQUENCE_PROPERTY
          system property name to use for initialization whether to use unordered sequences as the default sequence type during binding
 
Constructor Summary
JBossXBBuilder()
           
 
Method Summary
static SchemaBinding build(boolean rebuildFirst, Class<?>... roots)
          Builds a schema binding from an array of classes.
static SchemaBinding build(Class<?>... roots)
          Calls build(false, roots).
static SchemaBinding build(Class<?> root)
          Build the SchemaBinding from the class
static SchemaBinding build(Class<?> root, boolean rebuild)
          Build the SchemaBinding from the class.
static void build(SchemaBinding schemaBinding, Class<?> root)
          Build from a preparsed schema binding.
static String generateXMLNameFromClassName(org.jboss.reflect.spi.TypeInfo typeInfo, boolean ignoreLowerLine)
          Generate an xml name from a clazz name
static String generateXMLNameFromJavaName(String string, boolean dash, boolean ignoreLowerLine)
          Generate an xml name from a java name
protected static void initSchema(SchemaBinding schemaBinding, org.jboss.reflect.spi.ClassInfo classInfo)
          Initialize the schema binding from the root
static boolean isElementSetParentOverrideHandler()
           
static boolean isRepeatableParticleHandlers()
           
static boolean isSequencesRequirePropOrder()
           
static boolean isUseUnorderedSequence()
           
static
<T> SchemaBindingInitializer
newInitializer(Class<T> root)
          Create a new schema binding initializer
static void setElementSetParentOverrideHandler(boolean elementSetParentHandler)
           
static void setRepeatableParticleHandlers(boolean repeatableParticleHandlers)
           
static void setSequencesRequirePropOrder(boolean sequencesRequirePropOrder)
           
static void setUseUnorderedSequence(boolean unorderedSequences)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

USE_UNORDERED_SEQUENCE_PROPERTY

public static final String USE_UNORDERED_SEQUENCE_PROPERTY
system property name to use for initialization whether to use unordered sequences as the default sequence type during binding

See Also:
Constant Field Values

SEQUENCES_REQUIRE_PROP_ORDER

public static final String SEQUENCES_REQUIRE_PROP_ORDER
system property name to use for initialization whether to enforce the presence of propOrder in XmlType annotation when content of the type is bound to a sequence

See Also:
Constant Field Values

ELEMENT_SET_PARENT_OVERRIDE_HANDLER

public static final String ELEMENT_SET_PARENT_OVERRIDE_HANDLER
system property name to use for initialization General purpose handlers in setParent do a map.get(QName) to find the correct property handler to add the child to the parent. In case of non-global elements/groups we know the parent and the property from the beginning (during binding), so these terms could have a handler that would use the property directly.

See Also:
Constant Field Values

REPEATABLE_PARTICLE_HANDLERS

public static final String REPEATABLE_PARTICLE_HANDLERS
system property name to use for initialization Used for collection or array properties. To avoid calling property getter to get the collection value and then add the just unmarshalled item, all the items could be collected first instead and then property setter could be called to set the final value. This is what repeatable particle handlers do.

See Also:
Constant Field Values
Constructor Detail

JBossXBBuilder

public JBossXBBuilder()
Method Detail

isUseUnorderedSequence

public static boolean isUseUnorderedSequence()

setUseUnorderedSequence

public static void setUseUnorderedSequence(boolean unorderedSequences)

isSequencesRequirePropOrder

public static boolean isSequencesRequirePropOrder()

setSequencesRequirePropOrder

public static void setSequencesRequirePropOrder(boolean sequencesRequirePropOrder)

isElementSetParentOverrideHandler

public static boolean isElementSetParentOverrideHandler()

setElementSetParentOverrideHandler

public static void setElementSetParentOverrideHandler(boolean elementSetParentHandler)

isRepeatableParticleHandlers

public static boolean isRepeatableParticleHandlers()

setRepeatableParticleHandlers

public static void setRepeatableParticleHandlers(boolean repeatableParticleHandlers)

newInitializer

public static <T> SchemaBindingInitializer newInitializer(Class<T> root)
Create a new schema binding initializer

Type Parameters:
T - the root type
Parameters:
root - the root class
Returns:
the initializer
Throws:
IllegalArgumentException - for a null root

build

public static SchemaBinding build(Class<?>... roots)
Calls build(false, roots).

Parameters:
roots -
Returns:

build

public static SchemaBinding build(boolean rebuildFirst,
                                  Class<?>... roots)
Builds a schema binding from an array of classes. The classes must be mapped to the same namespace. SchemaBinding for the first class will be built by calling build(root, rebuildFirst). For each subsequent class build(SchemaBinding, root) will be called passing in the schema binding created for the first root class.

Parameters:
rebuildFirst -
roots -
Returns:

build

public static void build(SchemaBinding schemaBinding,
                         Class<?> root)
Build from a preparsed schema binding. The target namespaces of the SchemaBinding and the class must be equal. Otherwise, an exception will be thrown. Schema properties defined with annotations on the class will be ignored and won't override the ones in the SchemaBinding instance (except for the prefix mappings which unless a conflict found will be added to the SchemaBinding and in case of prefix mapping conflict an exception will be thrown).

Parameters:
schemaBinding - the schema binding
root - the root
Throws:
IllegalArgumentException - for a null schema binding or root

build

public static SchemaBinding build(Class<?> root)
Build the SchemaBinding from the class

Parameters:
root - the root
Returns:
the schema binding
Throws:
IllegalArgumentException - for a null root

build

public static SchemaBinding build(Class<?> root,
                                  boolean rebuild)
Build the SchemaBinding from the class. If the SchemaBinding has previously been buil, cached and rebuild argument is false then the previously built SchemaBinding is returned. Otherwise, a new SchemaBinding instance is built and cached.

Parameters:
root -
rebuild -
Returns:

initSchema

protected static void initSchema(SchemaBinding schemaBinding,
                                 org.jboss.reflect.spi.ClassInfo classInfo)
Initialize the schema binding from the root

Parameters:
schemaBinding - the schema binding
classInfo - the classInfo

generateXMLNameFromClassName

public static String generateXMLNameFromClassName(org.jboss.reflect.spi.TypeInfo typeInfo,
                                                  boolean ignoreLowerLine)
Generate an xml name from a clazz name

Parameters:
typeInfo - the typeInfo
ignoreLowerLine - whether to ignore the lower line
Returns:
the xml name

generateXMLNameFromJavaName

public static String generateXMLNameFromJavaName(String string,
                                                 boolean dash,
                                                 boolean ignoreLowerLine)
Generate an xml name from a java name

Parameters:
string - the java name
dash - whether to insert dashes to seperate words
ignoreLowerLine - TODO ignore the lower line
Returns:
the xml name

JBoss XML Binding 2.0.3.GA-redhat-2

Copyright © 2012 JBoss by Red Hat. All Rights Reserved.