public abstract class Model extends org.json.simple.JSONObject implements Map, org.json.simple.JSONAware, org.json.simple.JSONStreamAware
JSONObject's interfaces.
Inspiration taken from: http://code.google.com/p/opensocial-java-client/source/browse/trunk/java/src/org/opensocial/models/Model.javaAbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>| Modifier and Type | Field and Description |
|---|---|
protected PropertyChangeSupport |
propertyChanges
The property change event support for this model.
|
| Constructor and Description |
|---|
Model() |
| Modifier and Type | Method and Description |
|---|---|
void |
addPropertyChangeListener(PropertyChangeListener listener)
Adds a property change event listener to this model
|
void |
addToListField(String fieldName,
Object item)
Adds the passed Object to the list field with the specified name.
|
PropertyChangeListener[] |
findPropertyChangeListeners()
Gets the property change listeners registered and associated with this property change listener.
|
Object |
getField(String fieldName)
Returns the value of the specified field as an Object.
|
List |
getFieldAsList(String fieldName)
Returns the value of the specified field as a
List. |
Map |
getFieldAsMap(String fieldName)
Returns the value of the specified field as a
Map. |
String |
getFieldAsString(String fieldName)
Returns the value of the specified field as a
String. |
String[] |
getFieldNames()
Returns the complete set of properties associated with the model instance.
|
boolean |
hasField(String fieldName)
Returns
true if a value is associated with the specified field name, false otherwise. |
boolean |
isFieldMultikeyed(String fieldName)
|
boolean |
isFieldMultivalued(String fieldName)
|
void |
removePropertyChangeListener(PropertyChangeListener listener)
Removes a property change event listener which was added to this model.
|
void |
setField(String fieldName,
Object value)
Sets the value of the specified field to the passed Object.
|
escape, toJSONString, toJSONString, toString, toString, writeJSONString, writeJSONStringclear, clone, containsKey, containsValue, entrySet, get, isEmpty, keySet, put, putAll, remove, size, valuesequals, hashCodefinalize, getClass, notify, notifyAll, wait, wait, waitprotected PropertyChangeSupport propertyChanges
public String[] getFieldNames()
public boolean hasField(String fieldName)
true if a value is associated with the specified field name, false otherwise.fieldName - name of field to look uppublic Object getField(String fieldName)
fieldName - name of field whose value is to be returnedpublic Map getFieldAsMap(String fieldName)
Map. Equivalent to (Map) getField(fieldName), hence
this method will throw a ClassCastException if the field does not implement Map.fieldName - name of field whose value is to be returnedClassCastExceptionpublic List getFieldAsList(String fieldName)
List. Equivalent to (List)
getField(fieldName), hence this method will throw a ClassCastException if the field does not implement List.fieldName - name of field whose value is to be returnedClassCastExceptionpublic String getFieldAsString(String fieldName)
String. Equivalent to (String) getField(fieldName),
hence this method will throw a ClassCastException if the field is not of type String.fieldName - name of field whose value is to be returnedClassCastExceptionpublic boolean isFieldMultikeyed(String fieldName)
fieldName - name of field to look uppublic boolean isFieldMultivalued(String fieldName)
fieldName - name of field to look uppublic void setField(String fieldName, Object value)
fieldName - name of field to setvalue - object to associate with passed field namepublic void addToListField(String fieldName, Object item)
fieldName - name of list field for which the passed item should be addeditem - item to addpublic void addPropertyChangeListener(PropertyChangeListener listener)
listener - The listener to be addedpublic void removePropertyChangeListener(PropertyChangeListener listener)
listener - The listener to be removed.public PropertyChangeListener[] findPropertyChangeListeners()
Copyright © 2011–2015 eXo Platform SAS. All rights reserved.