public interface XmlRootHandle<T>
Modifier and Type | Method and Description |
---|---|
void |
addChangeListener(VetoableChangeListener... listeners)
Adds a change listener to be invoked before any property is
set or a bean is added.
|
void |
addRoot()
This method can be used if the root of the
tree has no required fields, and is the
combination of
XmlService.createBean(Class)
and addRoot(Object) . |
void |
addRoot(T root)
If this handle does not already have a
root bean this method will add the one
given
|
List<VetoableChangeListener> |
getChangeListeners()
Gets the current list of change listeners
|
T |
getReadOnlyRoot(boolean representDefaults)
This method returns a read-only copy of the existing
tree.
|
T |
getRoot()
Gets the root of the JavaBean tree
|
Class<T> |
getRootClass()
Returns the root interface of this handle
|
URI |
getURI()
Represents the original URI from which this
tree was parsed (or null if this tree did not
come from a URI)
|
XmlRootCopy<T> |
getXmlRootCopy()
Creates a copy of this tree that is not advertised.
|
boolean |
isAdvertisedInHub()
Returns true if this handles root and children
are advertised in the
Hub |
boolean |
isAdvertisedInLocator()
Returns true if this handles root and children
are advertised in it service locator
|
boolean |
isValidating()
True if this handle is currently validating
changes
|
XmlHandleTransaction<T> |
lockForTransaction()
This method will lock the bean tree represented by
this XmlRootHandle and start a transaction.
|
void |
marshal(OutputStream outputStream)
Will marshal this tree into the given stream.
|
void |
marshal(OutputStream outputStream,
Map<String,Object> options)
Will marshal this tree into the given stream.
|
void |
overlay(XmlRootHandle<T> newRoot)
This method overlays the current root and children with
the root and children from newRoot.
|
void |
removeChangeListener(VetoableChangeListener... listeners)
Removes a change listener.
|
T |
removeRoot()
If this handle has a root this method
will delete it and all children, leaving
the root of this tree null
|
void |
startValidating()
Does javax validation on the root bean from the root.
|
void |
stopValidating()
Stops this root handle from doing javax validation
on modifications
|
T getRoot()
Class<T> getRootClass()
URI getURI()
boolean isAdvertisedInLocator()
boolean isAdvertisedInHub()
Hub
Hub
T getReadOnlyRoot(boolean representDefaults)
If representsDefaults is true then getters for unset fields will return the default value. If representsDefaults is false then getters for unset fields will return null (or 0 (and false) for scalars). Setting representsDefault to false is useful if this tree is to be used to marshall back to XML, since JAXB will then not write the values back out to the file
representDefaults
- If true getters will return default values,
if false getters will return null (or zero/false for scalars)XmlRootCopy<T> getXmlRootCopy()
There is no requirement to call XmlRootCopy.merge()
since the parent keeps no track of children. However,
the XmlRootCopy.merge()
method will fail if
a modification has been made to the parent since the
time the copy was created
void overlay(XmlRootHandle<T> newRoot)
All nodes that are at the same spot in the tree (have the same xpath and same instance name) will not be modified, but will instead have attributes changed. All nodes present in newRoot but not in this root will be considered adds. All nodes not present in newRoot but in this root will be considered deletes
The URI will not be modified by this call, nor will the state of advertisement
newRoot
- The non-null root that will be overlayed
onto this handlevoid addRoot(T root)
root
- The non-null instance of the
root type of this handleIllegalStateException
- if this handle
already has a rootvoid addRoot()
XmlService.createBean(Class)
and addRoot(Object)
. This method
will throw an exception from the validator
(if validation is enabled) if the root type
has required fields or fails other validationT removeRoot()
void addChangeListener(VetoableChangeListener... listeners)
Rules for change listener:
listeners
- non-null listeners to be called whenever
a property is changed in any bean in this root. Must be
suitable for storage in a HashSetvoid removeChangeListener(VetoableChangeListener... listeners)
listener
- non-null listeners to be removed. Must be
suitable for lookup in a HashSetList<VetoableChangeListener> getChangeListeners()
XmlHandleTransaction<T> lockForTransaction() throws IllegalStateException
In particular, the code using this transaction should logically behave like the following code:
XmlHandleTransactiontransaction = root.lockForTransaction(); try { // Do many many edits all at once } finally { transaction.commit(); }
IllegalStateException
- if this bean tree is not allowed to have
a transaction started on itvoid startValidating()
ConstraintViolationException
void stopValidating()
boolean isValidating()
void marshal(OutputStream outputStream) throws IOException
outputStream
- A non-closed output stream. This method will
not close the output streamIOException
- On any exception that might happenvoid marshal(OutputStream outputStream, Map<String,Object> options) throws IOException
outputStream
- A non-closed output stream. This method will
not close the output streamoptions
- optional (possibly null) options from the callerIOException
- On any exception that might happenCopyright © 2009–2023 Oracle Corporation. All rights reserved.