org.eclipse.rse.core.model
Class RSEPersistableObject
java.lang.Object
org.eclipse.rse.core.model.RSEPersistableObject
-
All Implemented Interfaces:
-
IRSEPersistableContainer
-
Direct Known Subclasses:
-
PropertySetContainer
-
public abstract class RSEPersistableObject
- extends
Object
- implements
IRSEPersistableContainer
An object that keeps track of its persistable state:
whether it is dirty or not and whether or not
any of its progeny are marked dirty.
Method Summary
|
protected boolean
|
compareStrings
(
String s1,
String s2)
Does a null-aware string comparison. |
boolean
|
isDirty
()
An object is dirty if a change has been made to it that requires
it to be persisted. |
boolean
|
isTainted
()
An object is tainted if it contains an object that is dirty
somewhere in its containment hierarchy. |
void
|
setDirty
(boolean flag)
An object is dirty if a change has been made to it that requires
it to be persisted. |
void
|
setTainted
(boolean flag)
Sets the tainted attribute for this object. |
void
|
setWasRestored
(boolean flag)
Sets the restored state of the object. |
boolean
|
wasRestored
()
An object was restored if it originated from a persistent form. |
Methods inherited from class java.lang.
Object
|
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait
|
RSEPersistableObject
public RSEPersistableObject()
isDirty
public final boolean isDirty()
-
Description copied from interface:
IRSEPersistableContainer
- An object is dirty if a change has been made to it that requires
it to be persisted.
-
-
Specified by:
-
isDirty
in interface
IRSEPersistableContainer
-
-
Returns:
- true if the object is dirty
setDirty
public final void setDirty(boolean flag)
-
Description copied from interface:
IRSEPersistableContainer
-
An object is dirty if a change has been made to it that requires
it to be persisted. Objects should usually mark themselves dirty
when a persistable change is made. However, there may be a need
to mark related objects dirty as well.
Persistable changes are:
- Any modification of a persistable attribute
- A rename
- A deletion of a child object
- A reordering of the list of child objects
- The addition of a child object
A rename may also cause a parent to be marked dirty if the
parent refers to the child by name.
Setting this value to false should be done only in the persistence
manager after the object has been written to the DOM.
Marking an object as dirty must cause it and all of its ancestors
in the persistence hierarchy to be marked as tainted.
-
-
Specified by:
-
setDirty
in interface
IRSEPersistableContainer
-
-
Parameters:
-
flag
- true if the object must be persisted.
wasRestored
public final boolean wasRestored()
-
Description copied from interface:
IRSEPersistableContainer
- An object was restored if it originated from a persistent form.
-
-
Specified by:
-
wasRestored
in interface
IRSEPersistableContainer
-
-
Returns:
- true if the object was created from its persistent form,
false if the object has never been persisted.
setWasRestored
public final void setWasRestored(boolean flag)
-
Description copied from interface:
IRSEPersistableContainer
- Sets the restored state of the object. Only persistence managers
should do this. Persistable objects should be initially created with
this as false and the persistence manager set this to true.
This attribute is "sticky" in the face of most property changes.
It should be set false if the object is renamed or re-parented.
-
-
Specified by:
-
setWasRestored
in interface
IRSEPersistableContainer
-
-
Parameters:
-
flag
- true if the object was restored.
isTainted
public final boolean isTainted()
-
Description copied from interface:
IRSEPersistableContainer
- An object is tainted if it contains an object that is dirty
somewhere in its containment hierarchy.
-
-
Specified by:
-
isTainted
in interface
IRSEPersistableContainer
-
-
Returns:
- true if the object is tainted.
setTainted
public final void setTainted(boolean flag)
-
Description copied from interface:
IRSEPersistableContainer
- Sets the tainted attribute for this object. This should set to
true only by child objects when they have been marked dirty or tainted.
Setting this to true will cause all parent objects in the containment
hierarchy to be marked tainted.
It should be set to false only by a persistence manager when the
object has been committed.
-
-
Specified by:
-
setTainted
in interface
IRSEPersistableContainer
-
-
Parameters:
-
flag
- the tainted state of the object.
compareStrings
protected boolean compareStrings(
String s1,
String s2)
- Does a null-aware string comparison. Two strings that are
null
will compare equal. Otherwise the result is
the same as s1.equals(s2), if s1 is not null.
-
-
-
Parameters:
-
s1
- The first string to compare -
s2
- the second string
-
Returns:
- true if the strings are equal or both null.
Copyright (c) IBM Corporation and others 2000, 2008. All Rights Reserved.