T - the type of the object itself, ugly but necessary Java solutionP - the return type of the getAsJson() function used to retrieve a JSON representation of this objectpublic abstract class AbstractRestObject<T extends AbstractRestObject<T,P>,P> extends Object implements IEventListener
| Modifier and Type | Field and Description |
|---|---|
protected String |
moduleName |
| Constructor and Description |
|---|
AbstractRestObject(String moduleName,
Class<? extends GetRestObjectEvent<T>> getterEventClass)
Constructor that requires the moduleName for pretty printing and the class
of the GetRestObjectEvent that is used to retrieve the singleton instance of this object.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addEventListeners()
Adds event listeners.
|
abstract P |
getAsJson(javax.ws.rs.core.MultivaluedMap<String,String> query)
Returns a JSON representation of this object.
|
String |
getAsPlainText()
Returns a pretty print representation of this object along
with a title.
|
protected abstract String |
getPrettyPlainText()
Returns a pretty print representation of this object.
|
protected void |
onContextDestroyed(ContextDestroyedEvent event)
Cleans up all objects that are used by this object and removes event listeners.
|
void |
removeEventListeners()
Removes all event listeners of this class.
|
protected final String moduleName
public AbstractRestObject(String moduleName, Class<? extends GetRestObjectEvent<T>> getterEventClass)
moduleName - the name of the servicegetterEventClass - the class of a GetRestObjectEventpublic void addEventListeners()
IEventListeneraddEventListeners in interface IEventListenerpublic void removeEventListeners()
IEventListenerremoveEventListeners in interface IEventListenerpublic final String getAsPlainText()
protected abstract String getPrettyPlainText()
public abstract P getAsJson(javax.ws.rs.core.MultivaluedMap<String,String> query)
query - optional query parameters from the HTTP requestprotected void onContextDestroyed(ContextDestroyedEvent event)
event - the event that triggered the callback functionCopyright © 2017–2019. All rights reserved.