public abstract class Resource<T> extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
Resource.ChangeListenerType |
| Modifier and Type | Field and Description |
|---|---|
static int |
RESPONSE_TIMEOUT |
static String |
ROOT_RESOURCE_NAME |
| Constructor and Description |
|---|
Resource(String resourceResourceName) |
Resource(String resourceResourceName,
T value) |
| Modifier and Type | Method and Description |
|---|---|
void |
add(Resource child) |
void |
addPropertyChangeListener(PropertyChangeListener listener)
Add a new listener to be notified when the value is changed.
|
void |
addPropertyChangeListener(Resource.ChangeListenerType type,
PropertyChangeListener listener)
Add a new listener to be notified when the location is changed.
|
protected void |
fireEvent(boolean fire) |
void |
fireEvent(String event) |
String |
getCanonicalName() |
Resource |
getChild(String resourceResourceName) |
Collection<Resource> |
getChildren() |
Resource |
getParent() |
int |
getRC()
Returns the return code of the last location update notification.
|
String |
getResourceName() |
boolean |
getResponseRequired() |
T |
getValue() |
void |
notifyExternalListeners() |
boolean |
remove(Resource child) |
Resource |
remove(String resourceResourceName)
Removes the child with the specified resourceResourceName and returns it.
|
void |
removePropertyChangeListener(PropertyChangeListener listener)
Remove the specified listener.
|
void |
setParent(Resource parent) |
void |
setRC(int rc)
Used by the client library to set return code received in the response from Watson IoT Platform.
|
void |
setValue(T value) |
void |
setValue(T value,
boolean fireEvent) |
abstract com.google.gson.JsonElement |
toJsonObject() |
abstract int |
update(com.google.gson.JsonElement json) |
abstract int |
update(com.google.gson.JsonElement json,
boolean fireEvent) |
void |
waitForResponse(boolean responseRequired)
Requests that Watson IoT Platform to respond when it receives update notification.
|
public static final String ROOT_RESOURCE_NAME
public static final int RESPONSE_TIMEOUT
public Resource(String resourceResourceName)
public T getValue()
public void setValue(T value)
public void setValue(T value, boolean fireEvent)
protected void fireEvent(boolean fire)
public void fireEvent(String event)
public void notifyExternalListeners()
public void add(Resource child)
public boolean remove(Resource child)
public Resource remove(String resourceResourceName)
resourceResourceName - the resourceResourceNamepublic Resource getParent()
public void setParent(Resource parent)
public String getResourceName()
public String getCanonicalName()
public Collection<Resource> getChildren()
public abstract com.google.gson.JsonElement toJsonObject()
public void addPropertyChangeListener(PropertyChangeListener listener)
listener - PropertyChangeListenerpublic void addPropertyChangeListener(Resource.ChangeListenerType type, PropertyChangeListener listener)
type - The type of listenerlistener - PropertyChangeListenerpublic void removePropertyChangeListener(PropertyChangeListener listener)
listener - PropertyChangeListenerpublic abstract int update(com.google.gson.JsonElement json)
public abstract int update(com.google.gson.JsonElement json,
boolean fireEvent)
public void waitForResponse(boolean responseRequired)
responseRequired - boolean specifying whether response is required or notpublic int getRC()
public void setRC(int rc)
rc - return code to be setpublic boolean getResponseRequired()
Copyright © 2019. All rights reserved.