public interface Persistable
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
CONTAINER_ELEMENT
"CONTAINER_ELEMENT", The general key name representing the container element.
|
| Modifier and Type | Method and Description |
|---|---|
java.util.Map<java.lang.String,java.lang.Object> |
getContents() |
java.util.Map<java.lang.String,java.lang.Object> |
getContents(java.util.Map<java.lang.String,java.lang.String> elementAlternativeValues,
java.util.Set<java.lang.String> ignoredFields,
boolean includeContainer)
Turn the Persistable hierarchical contents Map (
getContents()) into a flat-key Map. |
java.lang.Object |
getField(java.lang.String persistKey)
Get the field's value of this Persistable object according to the persist-key.
The field name can be got from getPersitableFields() according to the persist-key, then the value will be got of that field. |
java.lang.String |
getFlatKey()
A Persistable object can contain other Persistable objects, it is an hierarchical structure.
|
Persistable |
getParent() |
java.util.Map<java.lang.String,java.lang.String> |
getPersitableFields()
This Map contains a pair, the key is the 'class field name' telling us which field needs
to be persisted; the value is a 'unique string' representing this class field in the
persistence.
|
boolean |
isEnabled()
Tell us if this object will be persisted or not.
|
void |
setEnabled(boolean enabled)
Sometimes, we don't want to persist an object, we disable it.
|
boolean |
setField(java.lang.String persistKey,
java.lang.Object value)
Set the field's value of this Persistable object to the persist-key.
The field name can be got from getPersitableFields() according to the persist-key, then the value will be set to that field. |
void |
setParent(Persistable parent)
|
static final java.lang.String CONTAINER_ELEMENT
<Response> <StatusCode>200</StatusCode> </Response>
java.util.Map<java.lang.String,java.lang.Object> getContents()
java.util.Map<java.lang.String,java.lang.String> getPersitableFields()
boolean isEnabled()
void setEnabled(boolean enabled)
enabled - boolean, if true, this object will be persisted; otherwise, will not.void setParent(Persistable parent)
Persistor and Verifier can work correctly.parent - Persistable,Persistable getParent()
java.lang.String getFlatKey()
#getContents(Map, Set)java.util.Map<java.lang.String,java.lang.Object> getContents(java.util.Map<java.lang.String,java.lang.String> elementAlternativeValues,
java.util.Set<java.lang.String> ignoredFields,
boolean includeContainer)
getContents()) into a flat-key Map.elementAlternativeValues - MapignoredFields - SetIf this Set contains a field 'Response.Request', then all its children will be ignored, such as: Response.Request.Headers Response.Request.MessageBody ...
includeContainer - boolean, in, if the Persistable Object itself should be considered as part of the whole contents.
(Response.ID, "FFE3543545JLFS")
(Response.Headers, "{Date=Tue, 06 DEC 2016 03:08:12 GMT}")
(Response.Request.Headers, "{Content-Length=4574, Via=1.1 inetgw38 (squid)}")
boolean setField(java.lang.String persistKey,
java.lang.Object value)
getPersitableFields() according to the persist-key, then the value will be set to that field.persistKey - String, the persist-key (it can be tag-name in XML, key-string in JSON etc.). refer to getPersitableFields().value - Object, the value to setjava.lang.Object getField(java.lang.String persistKey)
getPersitableFields() according to the persist-key, then the value will be got of that field.persistKey - String, the persist-key (it can be tag-name in XML, key-string in JSON etc.). refer to getPersitableFields().value - Object, the value of the field pointing by persistKey.Copyright © SAS Institute. All Rights Reserved.