|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.deepamehta.core.model.CompositeValueModel
public class CompositeValueModel
A recursive composite of key/value pairs. ### FIXDOC
Keys are strings, values are non-null atomic (string, int, long, double, boolean)
or again a CompositeValueModel
. ### FIXDOC
Field Summary | |
---|---|
private Map<String,Object> |
childTopics
Internal representation. |
private static String |
DEL_PREFIX
|
private Logger |
logger
|
private static String |
REF_ID_PREFIX
|
private static String |
REF_URI_PREFIX
|
Constructor Summary | |
---|---|
CompositeValueModel()
|
|
CompositeValueModel(JSONObject values)
|
Method Summary | |
---|---|
CompositeValueModel |
add(String childTypeUri,
TopicModel value)
Adds a value to a multiple-valued child. |
CompositeValueModel |
addDeletionRef(String childTypeUri,
long refTopicId)
Adds a by-ID topic deletion reference to a multiple-valued child. |
CompositeValueModel |
addRef(String childTypeUri,
long refTopicId)
Adds a by-ID topic reference to a multiple-valued child. |
CompositeValueModel |
addRef(String childTypeUri,
String refTopicUri)
Adds a by-URI topic reference to a multiple-valued child. |
CompositeValueModel |
clone()
|
private TopicModel |
createTopicModel(String childTypeUri,
Object value)
Creates a topic model from a JSON value. |
private long |
delTopicId(String val)
|
Object |
get(String childTypeUri)
Accesses a child generically, regardless of single-valued or multiple-valued. |
boolean |
getBoolean(String childTypeUri)
Convenience accessor for the *simple* value of a single-valued child. |
boolean |
getBoolean(String childTypeUri,
boolean defaultValue)
Convenience accessor for the *simple* value of a single-valued child. |
CompositeValueModel |
getCompositeValueModel(String childTypeUri)
Convenience accessor for the *composite* value of a single-valued child. |
CompositeValueModel |
getCompositeValueModel(String childTypeUri,
CompositeValueModel defaultValue)
Convenience accessor for the *composite* value of a single-valued child. |
double |
getDouble(String childTypeUri)
Convenience accessor for the *simple* value of a single-valued child. |
double |
getDouble(String childTypeUri,
double defaultValue)
Convenience accessor for the *simple* value of a single-valued child. |
int |
getInt(String childTypeUri)
Convenience accessor for the *simple* value of a single-valued child. |
int |
getInt(String childTypeUri,
int defaultValue)
Convenience accessor for the *simple* value of a single-valued child. |
long |
getLong(String childTypeUri)
Convenience accessor for the *simple* value of a single-valued child. |
long |
getLong(String childTypeUri,
long defaultValue)
Convenience accessor for the *simple* value of a single-valued child. |
Object |
getObject(String childTypeUri)
Convenience accessor for the *simple* value of a single-valued child. |
Object |
getObject(String childTypeUri,
Object defaultValue)
Convenience accessor for the *simple* value of a single-valued child. |
String |
getString(String childTypeUri)
Convenience accessor for the *simple* value of a single-valued child. |
String |
getString(String childTypeUri,
String defaultValue)
Convenience accessor for the *simple* value of a single-valued child. |
TopicModel |
getTopic(String childTypeUri)
Accesses a single-valued child. |
TopicModel |
getTopic(String childTypeUri,
TopicModel defaultValue)
Accesses a single-valued child. |
List<TopicModel> |
getTopics(String childTypeUri)
Accesses a multiple-valued child. |
List<TopicModel> |
getTopics(String childTypeUri,
List<TopicModel> defaultValue)
Accesses a multiple-valued child. |
boolean |
has(String childTypeUri)
Checks if a child is directly contained in this composite value. |
Iterator<String> |
iterator()
Returns an interator which iterates this composite value's child type URIs. |
CompositeValueModel |
put(String childTypeUri,
CompositeValueModel value)
Convenience method to put a *composite* value in a single-valued child. |
CompositeValueModel |
put(String childTypeUri,
List<TopicModel> values)
Sets the values of a multiple-valued child. |
CompositeValueModel |
put(String childTypeUri,
Object value)
Convenience method to put a *simple* value in a single-valued child. |
CompositeValueModel |
put(String childTypeUri,
TopicModel value)
Puts a value in a single-valued child. |
CompositeValueModel |
putRef(String childTypeUri,
long refTopicId)
Puts a by-ID topic reference for a single-valued child. |
CompositeValueModel |
putRef(String childTypeUri,
String refTopicUri)
Puts a by-URI topic reference for a single-valued child. |
private long |
refTopicId(String val)
|
private String |
refTopicUri(String val)
|
CompositeValueModel |
remove(String childTypeUri,
TopicModel value)
Removes a value from a multiple-valued child. |
int |
size()
Returns the number of childs directly contained in this composite value. |
void |
throwInvalidAccess(String childTypeUri,
ClassCastException e)
### TODO: should not be public. |
JSONObject |
toJSON()
|
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private static final String REF_ID_PREFIX
private static final String REF_URI_PREFIX
private static final String DEL_PREFIX
private Map<String,Object> childTopics
private Logger logger
Constructor Detail |
---|
public CompositeValueModel()
public CompositeValueModel(JSONObject values)
Method Detail |
---|
public TopicModel getTopic(String childTypeUri)
public TopicModel getTopic(String childTypeUri, TopicModel defaultValue)
public List<TopicModel> getTopics(String childTypeUri)
public List<TopicModel> getTopics(String childTypeUri, List<TopicModel> defaultValue)
public Object get(String childTypeUri)
public boolean has(String childTypeUri)
public int size()
public String getString(String childTypeUri)
public String getString(String childTypeUri, String defaultValue)
public int getInt(String childTypeUri)
public int getInt(String childTypeUri, int defaultValue)
public long getLong(String childTypeUri)
public long getLong(String childTypeUri, long defaultValue)
public double getDouble(String childTypeUri)
public double getDouble(String childTypeUri, double defaultValue)
public boolean getBoolean(String childTypeUri)
public boolean getBoolean(String childTypeUri, boolean defaultValue)
public Object getObject(String childTypeUri)
public Object getObject(String childTypeUri, Object defaultValue)
public CompositeValueModel getCompositeValueModel(String childTypeUri)
public CompositeValueModel getCompositeValueModel(String childTypeUri, CompositeValueModel defaultValue)
public CompositeValueModel put(String childTypeUri, TopicModel value)
public CompositeValueModel put(String childTypeUri, Object value)
value
- a String, Integer, Long, Double, or a Boolean.
public CompositeValueModel put(String childTypeUri, CompositeValueModel value)
public CompositeValueModel putRef(String childTypeUri, long refTopicId)
Used to maintain the assigment of an *aggregated* child. Not applicable for a *compositioned* child.
public CompositeValueModel putRef(String childTypeUri, String refTopicUri)
Used to maintain the assigment of an *aggregated* child. Not applicable for a *compositioned* child.
public CompositeValueModel add(String childTypeUri, TopicModel value)
public CompositeValueModel put(String childTypeUri, List<TopicModel> values)
public CompositeValueModel remove(String childTypeUri, TopicModel value)
public CompositeValueModel addRef(String childTypeUri, long refTopicId)
public CompositeValueModel addRef(String childTypeUri, String refTopicUri)
public CompositeValueModel addDeletionRef(String childTypeUri, long refTopicId)
public Iterator<String> iterator()
iterator
in interface Iterable<String>
public JSONObject toJSON()
public CompositeValueModel clone()
clone
in class Object
public String toString()
toString
in class Object
private TopicModel createTopicModel(String childTypeUri, Object value)
private long refTopicId(String val)
private String refTopicUri(String val)
private long delTopicId(String val)
public void throwInvalidAccess(String childTypeUri, ClassCastException e)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |