public class XMLObjectBuilderFactory extends Object
XMLObjectBuilder
s. XMLObjectBuilders are stored and retrieved by a
QName
key. This key is either the XML Schema Type or element QName of the XML element the
built XMLObject object represents.Modifier and Type | Field and Description |
---|---|
private Map<QName,XMLObjectBuilder<?>> |
builders
Registered builders.
|
private Logger |
log
Class logger.
|
Constructor and Description |
---|
XMLObjectBuilderFactory()
Constructor.
|
Modifier and Type | Method and Description |
---|---|
XMLObjectBuilder<?> |
deregisterBuilder(QName builderKey)
Deregisters a builder.
|
XMLObjectBuilder<?> |
getBuilder(Element domElement)
Retrieves the XMLObject builder for the given element.
|
XMLObjectBuilder<?> |
getBuilder(QName key)
Retrieves an
XMLObjectBuilder using the key it was registered with. |
<XMLObjectType extends XMLObject> |
getBuilderOrThrow(Element domElement)
Retrieves the
XMLObjectBuilder for the given element. |
<XMLObjectType extends XMLObject> |
getBuilderOrThrow(QName key)
Retrieves an
XMLObjectBuilder using the key it was registered with, or throws a runtime
error if unable to locate one. |
Map<QName,XMLObjectBuilder<?>> |
getBuilders()
Gets an immutable list of all the builders currently registered.
|
void |
registerBuilder(QName builderKey,
XMLObjectBuilder<?> builder)
Registers a new builder for the given name.
|
@Nonnull private final Map<QName,XMLObjectBuilder<?>> builders
@Nullable public XMLObjectBuilder<?> getBuilder(@Nullable QName key)
XMLObjectBuilder
using the key it was registered with.key
- the key used to register the builder@Nullable public XMLObjectBuilder<?> getBuilder(@Nullable Element domElement)
domElement
- the element to retrieve the builder for@Nonnull public <XMLObjectType extends XMLObject> XMLObjectBuilder<XMLObjectType> getBuilderOrThrow(@Nonnull QName key)
XMLObjectBuilder
using the key it was registered with, or throws a runtime
error if unable to locate one.XMLObjectType
- the type of object the builder is assumed to supportkey
- the key used to register the builderXMLRuntimeException
- if the builder can't be obtained@Nonnull public <XMLObjectType extends XMLObject> XMLObjectBuilder<XMLObjectType> getBuilderOrThrow(@Nonnull Element domElement)
XMLObjectBuilder
for the given element. The schema type, if present, is tried first
as the key with the element QName used if no schema type is present or does not have a builder registered
under it.XMLObjectType
- the type of object the builder is assumed to supportdomElement
- the element to retrieve the builder forXMLRuntimeException
- if the builder can't be obtained@Nonnull @NotLive @Unmodifiable public Map<QName,XMLObjectBuilder<?>> getBuilders()
public void registerBuilder(@Nonnull QName builderKey, @Nonnull XMLObjectBuilder<?> builder)
builderKey
- the key used to retrieve this builder laterbuilder
- the builder@Nullable public XMLObjectBuilder<?> deregisterBuilder(@Nonnull QName builderKey)
builderKey
- the key for the builder to be deregisteredCopyright © 1999–2015 JBoss by Red Hat. All rights reserved.