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()
XmlRootHandle
getRoot
in interface XmlRootHandle<T>
public Class<T> getRootClass()
XmlRootHandle
getRootClass
in interface XmlRootHandle<T>
public URI getURI()
XmlRootHandle
getURI
in interface XmlRootHandle<T>
public boolean isAdvertisedInLocator()
XmlRootHandle
isAdvertisedInLocator
in interface XmlRootHandle<T>
public boolean isAdvertisedInHub()
XmlRootHandle
Hub
isAdvertisedInHub
in interface XmlRootHandle<T>
Hub
public void overlay(XmlRootHandle<T> newRoot)
XmlRootHandle
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
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)
XmlRootHandle
addRoot
in interface XmlRootHandle<T>
newRoot
- The non-null instance of the
root type of this handlepublic void addRoot()
XmlRootHandle
XmlService.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()
XmlRootHandle
removeRoot
in interface XmlRootHandle<T>
public T getReadOnlyRoot(boolean representDefaults)
XmlRootHandle
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
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–2018 Oracle Corporation. All rights reserved.