public class ObjectResource extends HandleChain
This will allow the object chaining to work naturally as with other legacy resources, help with reference management and resource delete.
Modifier and Type | Field and Description |
---|---|
private java.util.Deque<java.lang.String> |
destructors
The destructors to be executed on delete.
|
private boolean |
pendingDelete
Flag indicating if this resource is being deleted.
|
private _BaseObject_ |
ref
The contained object instance.
|
private long |
references
The reference counter.
|
name, nextSibling, prevSibling
instProc
Constructor and Description |
---|
ObjectResource(_BaseObject_ reference)
Initialize this object with the given reference.
|
Modifier and Type | Method and Description |
---|---|
void |
decrement()
Decrement the reference counter.
|
void |
delete()
Perform actual delete of an resource.
|
(package private) void |
deleteSilent()
Silently delete this object, by ignoring all conditions.
|
(package private) long |
getReferences()
Get the current reference counter.
|
(package private) boolean |
hasActiveDestructors()
Checks whether the object has any destructor pushed on stack ready to be executed when the
lifetime of the object ends.
|
void |
increment()
Increment the reference counter.
|
(package private) boolean |
isPendingDelete()
Check if this resource is being deleted.
|
protected boolean |
processResource()
Check if this resource must be processed via
ProcedureManager.processResource(com.goldencode.p2j.util.WrappedResource, boolean) , once
it has been instantiated. |
(package private) void |
pushDestructor(java.lang.String mthd)
Add a new destructor on the stack.
|
_BaseObject_ |
ref()
Return the wrapped reference.
|
protected boolean |
resourceDelete()
Check if the resource can be deleted (is not
delayed ). |
boolean |
unknown()
Check if this resource is unknown.
|
boolean |
valid()
Check if this pseudo-resource is valid.
|
firstResource, firstResource, getHead, getNextSibling, getNextSibling, getPrevSibling, getPrevSibling, getPrivateData, getTail, hasName, hasNameConstraints, hasNameReadOnly, hasNextSibling, hasParent, hasPrevSibling, hasPrivateData, interlink, isChained, lastResource, lastResource, moveInChain, name, name, name, readOnlyError, readOnlyError, setHead, setNextSibling, setNextSibling, setPrevSibling, setPrevSibling, setPrivateData, setPrivateData, setPrivateData, validateName
doDelete, getResourceType, id, id, implicitDeletion, incrementTrigger, instantiatingProcedure, invalidAttribute, registerResource, setInstantiatingProcedure, toString, type, unableToAssignUnknown
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getResourceType
id, id
private _BaseObject_ ref
null
is unknown value.private long references
private java.util.Deque<java.lang.String> destructors
private boolean pendingDelete
public ObjectResource(_BaseObject_ reference)
reference
- The reference.public boolean unknown()
unknown
in interface WrappedResource
unknown
in class HandleResource
false
public boolean valid()
true
if ref
is not null
.public _BaseObject_ ref()
protected boolean processResource()
ProcedureManager.processResource(com.goldencode.p2j.util.WrappedResource, boolean)
, once
it has been instantiated.processResource
in class HandleResource
false
.public void increment()
public void decrement()
public void delete()
delete
in interface Deletable
delete
in class HandleChain
protected boolean resourceDelete()
delayed
).resourceDelete
in class HandleResource
true
boolean hasActiveDestructors()
true
if when the object is deleted at least one destructor will be
executed.void pushDestructor(java.lang.String mthd)
mthd
- The destructor method.long getReferences()
references
.void deleteSilent()
boolean isPendingDelete()
pendingDelete
state.