public class ChildTopicsModel extends Object implements Iterable<String>
Keys are strings, values are non-null atomic (string, int, long, double, boolean)
or again a ChildTopicsModel
. ### FIXDOC
Modifier and Type | Field and Description |
---|---|
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 and Description |
---|
ChildTopicsModel() |
ChildTopicsModel(org.codehaus.jettison.json.JSONObject values) |
Modifier and Type | Method and Description |
---|---|
ChildTopicsModel |
add(String childTypeUri,
RelatedTopicModel value)
Adds a value to a multiple-valued child.
|
ChildTopicsModel |
add(String childTypeUri,
TopicModel value) |
ChildTopicsModel |
addDeletionRef(String childTypeUri,
long refTopicId)
Adds a by-ID topic deletion reference to a multiple-valued child.
|
ChildTopicsModel |
addRef(String childTypeUri,
long refTopicId)
Adds a by-ID topic reference to a multiple-valued child.
|
ChildTopicsModel |
addRef(String childTypeUri,
String refTopicUri)
Adds a by-URI topic reference to a multiple-valued child.
|
ChildTopicsModel |
clone() |
private RelatedTopicModel |
createReferenceModel(Object value,
AssociationModel relatingAssoc) |
private RelatedTopicModel |
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.
|
ChildTopicsModel |
getChildTopicsModel(String childTypeUri)
Convenience accessor for the *composite* value of a single-valued child.
|
ChildTopicsModel |
getChildTopicsModel(String childTypeUri,
ChildTopicsModel 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.
|
RelatedTopicModel |
getTopic(String childTypeUri)
Accesses a single-valued child.
|
RelatedTopicModel |
getTopic(String childTypeUri,
RelatedTopicModel defaultValue)
Accesses a single-valued child.
|
List<RelatedTopicModel> |
getTopics(String childTypeUri)
Accesses a multiple-valued child.
|
List<RelatedTopicModel> |
getTopics(String childTypeUri,
List<RelatedTopicModel> defaultValue)
Accesses a multiple-valued child.
|
boolean |
has(String childTypeUri)
Checks if a child is contained in this ChildTopicsModel.
|
private void |
initTypeUri(org.codehaus.jettison.json.JSONObject value,
String childTypeUri) |
Iterator<String> |
iterator()
Returns an interator which iterates this ChildTopicsModel's child type URIs.
|
ChildTopicsModel |
put(String childTypeUri,
ChildTopicsModel value)
Convenience method to put a *composite* value in a single-valued child.
|
ChildTopicsModel |
put(String childTypeUri,
List<RelatedTopicModel> values)
Sets the values of a multiple-valued child.
|
ChildTopicsModel |
put(String childTypeUri,
Object value)
Convenience method to put a *simple* value in a single-valued child.
|
ChildTopicsModel |
put(String childTypeUri,
RelatedTopicModel value)
Puts a value in a single-valued child.
|
ChildTopicsModel |
put(String childTypeUri,
TopicModel value) |
ChildTopicsModel |
putRef(String childTypeUri,
long refTopicId)
Puts a by-ID topic reference in a single-valued child.
|
ChildTopicsModel |
putRef(String childTypeUri,
String refTopicUri)
Puts a by-URI topic reference in a single-valued child.
|
private long |
refTopicId(String val) |
private String |
refTopicUri(String val) |
ChildTopicsModel |
remove(String childTypeUri)
Removes a single-valued child.
|
ChildTopicsModel |
remove(String childTypeUri,
TopicModel value)
Removes a value from a multiple-valued child.
|
int |
size()
Returns the number of childs contained in this ChildTopicsModel.
|
void |
throwInvalidAccess(String childTypeUri,
ClassCastException e)
### TODO: should not be public.
|
org.codehaus.jettison.json.JSONObject |
toJSON() |
String |
toString() |
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
public ChildTopicsModel()
public ChildTopicsModel(org.codehaus.jettison.json.JSONObject values)
public RelatedTopicModel getTopic(String childTypeUri)
public RelatedTopicModel getTopic(String childTypeUri, RelatedTopicModel defaultValue)
public List<RelatedTopicModel> getTopics(String childTypeUri)
public List<RelatedTopicModel> getTopics(String childTypeUri, List<RelatedTopicModel> 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 ChildTopicsModel getChildTopicsModel(String childTypeUri)
public ChildTopicsModel getChildTopicsModel(String childTypeUri, ChildTopicsModel defaultValue)
public ChildTopicsModel put(String childTypeUri, RelatedTopicModel value)
public ChildTopicsModel put(String childTypeUri, TopicModel value)
public ChildTopicsModel put(String childTypeUri, Object value)
value
- a String, Integer, Long, Double, or a Boolean.public ChildTopicsModel put(String childTypeUri, ChildTopicsModel value)
public ChildTopicsModel putRef(String childTypeUri, long refTopicId)
public ChildTopicsModel putRef(String childTypeUri, String refTopicUri)
public ChildTopicsModel remove(String childTypeUri)
public ChildTopicsModel add(String childTypeUri, RelatedTopicModel value)
public ChildTopicsModel add(String childTypeUri, TopicModel value)
public ChildTopicsModel put(String childTypeUri, List<RelatedTopicModel> values)
public ChildTopicsModel remove(String childTypeUri, TopicModel value)
public ChildTopicsModel addRef(String childTypeUri, long refTopicId)
public ChildTopicsModel addRef(String childTypeUri, String refTopicUri)
public ChildTopicsModel addDeletionRef(String childTypeUri, long refTopicId)
public Iterator<String> iterator()
public org.codehaus.jettison.json.JSONObject toJSON()
public ChildTopicsModel clone()
private RelatedTopicModel createTopicModel(String childTypeUri, Object value) throws org.codehaus.jettison.json.JSONException
org.codehaus.jettison.json.JSONException
private RelatedTopicModel createReferenceModel(Object value, AssociationModel relatingAssoc)
private void initTypeUri(org.codehaus.jettison.json.JSONObject value, String childTypeUri) throws org.codehaus.jettison.json.JSONException
org.codehaus.jettison.json.JSONException
private long refTopicId(String val)
private String refTopicUri(String val)
private long delTopicId(String val)
public void throwInvalidAccess(String childTypeUri, ClassCastException e)
Copyright © 2015. All Rights Reserved.