public class XmlRootHandleImpl<T> extends Object implements XmlRootHandle<T>
| Modifier and Type | Method and Description |
|---|---|
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 XmlRootHandle.addRoot(Object). |
void |
addRoot(T newRoot)
If this handle does not already have a
root bean this method will add the one
given
|
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
|
void |
overlay(XmlRootHandle<T> newRoot)
This method overlays the current root and children with
the root and children from newRoot.
|
T |
removeRoot()
If this handle has a root this method
will delete it and all children, leaving
the root of this tree null
|
String |
toString() |
public T getRoot()
XmlRootHandlegetRoot in interface XmlRootHandle<T>public Class<T> getRootClass()
XmlRootHandlegetRootClass in interface XmlRootHandle<T>public URI getURI()
XmlRootHandlegetURI in interface XmlRootHandle<T>public boolean isAdvertisedInLocator()
XmlRootHandleisAdvertisedInLocator in interface XmlRootHandle<T>public boolean isAdvertisedInHub()
XmlRootHandleHubisAdvertisedInHub in interface XmlRootHandle<T>Hubpublic void overlay(XmlRootHandle<T> newRoot)
XmlRootHandleAll 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
overlay in interface XmlRootHandle<T>newRoot - The non-null root that will be overlayed
onto this handlepublic XmlRootCopy<T> getXmlRootCopy()
XmlRootHandle
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
getXmlRootCopy in interface XmlRootHandle<T>public void addRoot(T newRoot)
XmlRootHandleaddRoot in interface XmlRootHandle<T>newRoot - The non-null instance of the
root type of this handlepublic void addRoot()
XmlRootHandleXmlService.createBean(Class)
and XmlRootHandle.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 validationaddRoot in interface XmlRootHandle<T>public T removeRoot()
XmlRootHandleremoveRoot in interface XmlRootHandle<T>public T getReadOnlyRoot(boolean representDefaults)
XmlRootHandleIf 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
getReadOnlyRoot in interface XmlRootHandle<T>representDefaults - If true getters will return default values,
if false getters will return null (or zero/false for scalars)Copyright © 2009-2016 Oracle Corporation. All Rights Reserved.