|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.jstatcom.model.AbstractJSCData
com.jstatcom.model.JSCDate
public final class JSCDate
Adapter to TSDate
objects that conforms to the
JSCData
interface. Everytime something changes, a new
TSDate
object is created, because date objects are immutable.
Whenever the value of this data object changes, registered
JSCDataListeners
are notified via a JSCDataEvent
.
If not otherwise stated, the event objects always contain the values before
the change and after the change.
This class is thread-safe. All access to mutable data is synchronized. All events are fired outside the synchronized blocks.
TSDate
Field Summary | |
---|---|
static javolution.xml.XmlFormat<JSCDate> |
JSCDate_XML
XML format field for (de)serialization. |
Constructor Summary | |
---|---|
JSCDate(java.lang.String name)
Creates an empty JSCDate . |
|
JSCDate(java.lang.String name,
TSDate tsDate)
Creates a JSCDate for a given TSDate . |
Method Summary | |
---|---|
void |
addPeriods(int i)
Adds i periods to this date. |
void |
clear()
Clears this data object. |
JSCDate |
copy()
Gets a copy of the current object. |
TSDate |
getTSDate()
Gets the stored date object. |
boolean |
isEmpty()
Gets whether this is empty. |
boolean |
isEqual(JSCData o)
Gets whether the values of this data object and other are
logically equal. |
java.lang.String |
name()
Gets the name of the data object. |
void |
setVal(TSDate newDate)
Sets a new value to this date adapter. |
JSCTypes |
type()
Gets the type of this JSCData object. |
java.lang.Object |
value()
Gets the underlying value, which is stored as a TSDate . |
Methods inherited from class com.jstatcom.model.AbstractJSCData |
---|
addJSCDataListener, display, getJSCProperty, removeJSCDataListener, removeJSCProperty, setJSCProperty, toString |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final javolution.xml.XmlFormat<JSCDate> JSCDate_XML
Constructor Detail |
---|
public JSCDate(java.lang.String name)
JSCDate
.
name
- the identifier of that object
java.lang.IllegalArgumentException
- if name
is not valid or
if (name == null)
JSCConstants.isValidName(java.lang.String)
public JSCDate(java.lang.String name, TSDate tsDate)
JSCDate
for a given TSDate
.
name
- the identifier of that objecttsDate
- the date value
java.lang.IllegalArgumentException
- if name
is not valid or
if (name == null)
JSCConstants.isValidName(java.lang.String)
Method Detail |
---|
public void addPeriods(int i)
i
periods to this date.
i
- number of periods, can also be negative, nothing changes
if (i == 0)
java.lang.IllegalStateException
- isEmpty
public void clear()
this
data object. Fires:
JSCDataEventTypes.EMPTY_STATE
event
JSCDataEventTypes.VALUE_CHANGED
event
isEmpty
returns true
.
public JSCDate copy()
JSCData
a.isEqual(a.copy())
- compares values
a.getName().equals(a.copy().getName())
- compares
name
JSCDataListeners
attached to the original object should
not be copied.
JSCData
public TSDate getTSDate()
TSDate
or null
if emptypublic boolean isEmpty()
this
is empty. This method returns
true
, if value
returns null
.
true
if emptypublic boolean isEqual(JSCData o)
JSCData
other
are
logically equal.
true
if considered equal according to the logic of
the representationJSCData
public java.lang.String name()
JSCData
JSCConstants
.
JSCData
public void setVal(TSDate newDate)
JSCDataEvent
of type:
JSCDataEventTypes.VALUE_CHANGED
if
!newDate.equals(getTSDate())
JSCDataEventTypes.EMPTY_STATE
if
newDate != null
and this was empty before
JSCDataEventTypes.EMPTY_STATE
if
newDate == null
and this was not empty before
newDate
- the new date, if null
it is similar to
clear
public JSCTypes type()
JSCData
object.
JSCTypes.DATE
JSCTypes
public java.lang.Object value()
TSDate
.
null
if this
is
empty
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |