com.jstatcom.model
Class AbstractJSCData

java.lang.Object
  extended by com.jstatcom.model.AbstractJSCData
All Implemented Interfaces:
JSCData
Direct Known Subclasses:
JSCDate, JSCDRange, JSCInt, JSCMap, JSCNArray, JSCNumber, JSCSArray, JSCString, JSCVoid

public abstract class AbstractJSCData
extends java.lang.Object
implements JSCData

Abstract implementation of JSCData which provides default functionality for handling the different listeners.

Author:
Markus Kraetzig

Constructor Summary
AbstractJSCData()
           
 
Method Summary
 void addJSCDataListener(JSCDataListener evtListener, JSCDataEventTypes evtType)
          Adds a listener that is notified when changes of type evtType occur in this object.
 java.lang.String display()
          Default implementation that gets a string representing the value stored in this JSCData object.
 java.lang.Object getJSCProperty(JSCPropertyTypes type)
          Gets the value for a property type.
 void removeJSCDataListener(JSCDataListener evtListener)
          Removes a JSCDataListener from all different listener lists.
 void removeJSCProperty(JSCPropertyTypes type)
          Removes the property value for type.
 void setJSCProperty(JSCPropertyTypes type, java.lang.Object val)
          Set the value for a property type.
 java.lang.String toString()
          Gets a string representation of this JSCData instance.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.jstatcom.model.JSCData
clear, copy, isEmpty, isEqual, name, type, value
 

Constructor Detail

AbstractJSCData

public AbstractJSCData()
Method Detail

getJSCProperty

public java.lang.Object getJSCProperty(JSCPropertyTypes type)
Gets the value for a property type.

Specified by:
getJSCProperty in interface JSCData
Parameters:
type - the property type
Returns:
the value or null if the property has not been set
Throws:
java.lang.IllegalArgumentException - if (type == null)

setJSCProperty

public void setJSCProperty(JSCPropertyTypes type,
                           java.lang.Object val)
Set the value for a property type. Values are not serialized. The properties can be used to store runtime information associated with a data object.

Specified by:
setJSCProperty in interface JSCData
Parameters:
type - the property type
val - the associated property value
Throws:
java.lang.IllegalArgumentException - if (type == null)

removeJSCProperty

public void removeJSCProperty(JSCPropertyTypes type)
Description copied from interface: JSCData
Removes the property value for type.

Specified by:
removeJSCProperty in interface JSCData

toString

public java.lang.String toString()
Gets a string representation of this JSCData instance.

Overrides:
toString in class java.lang.Object
Returns:
string with name, type and value information

addJSCDataListener

public final void addJSCDataListener(JSCDataListener evtListener,
                                     JSCDataEventTypes evtType)
Description copied from interface: JSCData
Adds a listener that is notified when changes of type evtType occur in this object. All other events that are fired by this object are not dispatched to evtListener.

Specified by:
addJSCDataListener in interface JSCData
Parameters:
evtListener - the listener object that gets notified when an event of type evtType gets fired
evtType - the type of event that evtListener wants to listen to
See Also:
JSCData

display

public java.lang.String display()
Default implementation that gets a string representing the value stored in this JSCData object.

Specified by:
display in interface JSCData
Returns:
"{}" if isEmpty == true, otherwise value().toString()

removeJSCDataListener

public final void removeJSCDataListener(JSCDataListener evtListener)
Description copied from interface: JSCData
Removes a JSCDataListener from all different listener lists.

Specified by:
removeJSCDataListener in interface JSCData
Parameters:
evtListener - the listener object to be removed
See Also:
JSCData