public class XmlStateLock
extends java.lang.Object
XmlStateLock
class provides methods to interact with the
PureWeb application state, once you have acquired a state lock.
Instances of XmlStateLock
are obtained by calling
acquireLock
.
Instances of XmlStateLock
provide thread-safe read/write
access to XML state.
When referring to a value in the application state tree, provide the
entire path (except for the root element, which should be omitted),
dividing each level using a slash, for example:
/MainPage/TabX/ControlName
.
The path can also contain conditional operators:
/Definitions/#1
(first ordered child of an element
called Definitions)/Definition[Id=1;Type=Button]
(a Definition element with
Id of 1 and of type Button)Modifier and Type | Method and Description |
---|---|
org.jdom.Element |
getTree(java.lang.String path)
Returns the element at the specified path in the application state tree.
|
org.jdom.Element |
getTree(java.lang.String path,
boolean allowCreate)
Returns the element at the specified location,
or
null if it does not exist. |
java.lang.String |
getValue(java.lang.String path)
Returns the value of the element at the specified path in the a
application state tree.
|
java.lang.Object |
getValueAs(java.lang.Class cls,
java.lang.String path)
Returns the value of the element at the specified path in the
application state tree.
|
java.lang.Object |
getValueAs(java.lang.Class cls,
java.lang.String path,
java.lang.Object defaultValue)
Returns the value of the element at the specified path in the
application state tree.
|
void |
release()
Releases the lock on application state.
|
void |
setTree(java.lang.String path,
org.jdom.Element element)
Replaces or inserts the section of application state at and below
the specified path.
|
void |
setValue(java.lang.String path,
java.lang.Object value)
Sets the value of the element at the specified path in the
application state tree.
|
java.lang.String |
toString()
Returns the entire application state tree, expressed as a string.
|
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String getValue(java.lang.String path)
null
if the element
does not exist.public void setValue(java.lang.String path, java.lang.Object value)
public java.lang.Object getValueAs(java.lang.Class cls, java.lang.String path)
InvalidCastException
if the value does
not exist or cannot be converted.public java.lang.Object getValueAs(java.lang.Class cls, java.lang.String path, java.lang.Object defaultValue)
cls
- The Class
the type T.path
- The path.defaultValue
- The default value.public org.jdom.Element getTree(java.lang.String path)
public org.jdom.Element getTree(java.lang.String path, boolean allowCreate)
null
if it does not exist.
The copy is created if allowCreate
is set
to true
, otherwise will return null
.public void release()
public void setTree(java.lang.String path, org.jdom.Element element)
© 2010 - 2018 Calgary Scientific Inc. All Rights Reserved.
This documentation shall not wholly or in part, in any form or by any means, electronic, mechanical, including photocopying, be reproduced or transmitted without the authorized, written consent of Calgary Scientific.