JBoss XML Binding 2.0.3.GA-redhat-2

org.jboss.xb.util
Class JBossXBHelper<T>

java.lang.Object
  extended by org.jboss.xb.util.JBossXBHelper<T>
Type Parameters:
T - the expected type
All Implemented Interfaces:
FeatureAware

public class JBossXBHelper<T>
extends Object
implements FeatureAware

JBossXB deployer helper.

Author:
Ales Justin, Thomas Diesler

Constructor Summary
JBossXBHelper(Class<T> output)
          Create a new SchemaResolverDeployer.
 
Method Summary
static void addClassBinding(String namespace, Class<?> metadata)
          Deprecated. Use addTypeBinding(String, Class)
 void addTypeBinding(String namespace, Class<?> metadata)
          Add class binding.
static String findNamespace(Class<?> metadata)
          Find the namespace on class/package
protected  MutableSchemaResolver getResolver()
          Get the schema resolver.
 boolean isUseSchemaValidation()
          Get the useSchemaValidation.
 boolean isUseValidation()
          Get the useValidation.
 boolean isWarnOnParserErrors()
          This property controls whether the (underlying) parser errors should be logged as warnings or should they terminate parsing with errors.
<U> U
parse(Class<U> expectedType, InputSource source)
          Parse the file to create metadata instance.
<U> U
parse(Class<U> expectedType, InputSource source, U root, ObjectModelFactory omf)
          Parse the file using object model factory.
 T parse(InputSource source)
          Parse file to output metadata.
 T parse(InputSource source, T root, ObjectModelFactory omf)
          Parse the file using object model factory.
static void removeClassBinding(String namespace)
          Deprecated. Use removeTypeBinding(String)
 void removeTypeBinding(String namespace)
          Remove class binding.
 void setFeature(String featureName, boolean flag)
          Apply feature.
 void setUseSchemaValidation(boolean useSchemaValidation)
          Set the useSchemaValidation.
 void setUseValidation(boolean useValidation)
          Set the useValidation.
 void setWarnOnParserErrors(boolean value)
          This property controls whether the (underlying) parser errors should be logged as warnings or should they terminate parsing with errors.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JBossXBHelper

public JBossXBHelper(Class<T> output)
Create a new SchemaResolverDeployer.

Parameters:
output - the output
Throws:
IllegalArgumentException - for a null output
Method Detail

setFeature

public void setFeature(String featureName,
                       boolean flag)
                throws Exception
Description copied from interface: FeatureAware
Apply feature.

Specified by:
setFeature in interface FeatureAware
Parameters:
featureName - the feature name
flag - the feature flag
Throws:
Exception - for any error

isUseSchemaValidation

public boolean isUseSchemaValidation()
Get the useSchemaValidation.

Returns:
the useSchemaValidation.

setUseSchemaValidation

public void setUseSchemaValidation(boolean useSchemaValidation)
Set the useSchemaValidation.

Parameters:
useSchemaValidation - the useSchemaValidation.

isUseValidation

public boolean isUseValidation()
Get the useValidation.

Returns:
the useValidation.

setUseValidation

public void setUseValidation(boolean useValidation)
Set the useValidation.

Parameters:
useValidation - the useValidation.

isWarnOnParserErrors

public boolean isWarnOnParserErrors()
This property controls whether the (underlying) parser errors should be logged as warnings or should they terminate parsing with errors. The default is to terminate parsing by re-throwing parser errors.

Returns:
false if parser errors should be logged as warnings, otherwise - true

setWarnOnParserErrors

public void setWarnOnParserErrors(boolean value)
This property controls whether the (underlying) parser errors should be logged as warnings or should they terminate parsing with errors. The default is to terminate parsing by re-throwing parser errors.


addClassBinding

public static void addClassBinding(String namespace,
                                   Class<?> metadata)
Deprecated. Use addTypeBinding(String, Class)

Add class binding.

Parameters:
namespace - the namespace
metadata - the metadata

removeClassBinding

public static void removeClassBinding(String namespace)
Deprecated. Use removeTypeBinding(String)

Remove class binding.

Parameters:
namespace - the namespace

addTypeBinding

public void addTypeBinding(String namespace,
                           Class<?> metadata)
Add class binding.

Parameters:
namespace - the namespace
metadata - the metadata

removeTypeBinding

public void removeTypeBinding(String namespace)
Remove class binding.

Parameters:
namespace - the namespace

getResolver

protected MutableSchemaResolver getResolver()
Get the schema resolver. This implementation returns a singleton schema resolver.

Returns:
the resolver

findNamespace

public static String findNamespace(Class<?> metadata)
Find the namespace on class/package

Parameters:
metadata - the metadata class
Returns:
jboss xml schema namespace

parse

public T parse(InputSource source)
        throws Exception
Parse file to output metadata.

Parameters:
source - the source to parse
Returns:
new metadata instance
Throws:
Exception - for any error

parse

public <U> U parse(Class<U> expectedType,
                   InputSource source)
        throws Exception
Parse the file to create metadata instance.

Type Parameters:
U - the expect type
Parameters:
expectedType - the expected type
source - the source
Returns:
new metadata instance
Throws:
Exception - for any error

parse

public T parse(InputSource source,
               T root,
               ObjectModelFactory omf)
        throws Exception
Parse the file using object model factory.

Parameters:
source - the source to parse
root - the previous root
omf - the object model factory
Returns:
new metadata instance
Throws:
Exception - for any error

parse

public <U> U parse(Class<U> expectedType,
                   InputSource source,
                   U root,
                   ObjectModelFactory omf)
        throws Exception
Parse the file using object model factory.

Type Parameters:
U - the expect type
Parameters:
expectedType - the expected type
source - the source to parse
root - the previous root
omf - the object model factory
Returns:
new metadata instance
Throws:
Exception - for any error

JBoss XML Binding 2.0.3.GA-redhat-2

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