public abstract class HandleResource extends java.lang.Object implements CommonHandle, InstantiatingProcedure
attribute or base method | API |
---|---|
TYPE | getResourceType() and type() |
INSTANTIATING-PROCEDURE | instantiatingProcedure() |
Unknown status | unknown() |
Read only field error | readOnlyError(String) |
Invalid attribute access | invalidAttribute(String) |
The abstract class also provides setters for the implemented attributes which are not defined inside the interfaces to be used for initializing of those attributes
Modifier and Type | Field and Description |
---|---|
private java.lang.Long |
id
The resource's ID.
|
protected handle |
instProc
Handle referencing the instantiating procedure.
|
private java.lang.String |
type
Variable for holding the type attribute
|
Modifier | Constructor and Description |
---|---|
|
HandleResource()
Default c'tor.
|
protected |
HandleResource(boolean dynamic)
Initialize this resource by determining its type.
|
Modifier and Type | Method and Description |
---|---|
character |
getResourceType()
Get the type of this handle.
|
java.lang.Long |
id()
Get this resource's ID, if is already set.
|
void |
id(long id)
Set this resource's ID.
|
protected boolean |
implicitDeletion()
Check if the resource may be implicitly deleted.
|
handle |
instantiatingProcedure()
Getter for the INSTANTIATING-PROCEDURE attribute.
|
protected void |
invalidAttribute(java.lang.String attr)
To be used only in cases a getter for a not-supported attribute is forced to be implemented
by the resource.
|
void |
readOnlyError(java.lang.String attr)
To be used only in cases when a setter for a read-only attribute or a not-supported
attribute is forced to be implemented by the resource.
|
protected void |
setInstantiatingProcedure(handle hproc)
Set the instantiating procedure for this resource.
|
java.lang.String |
type()
Get the type of this handle as type of String.
|
boolean |
unknown()
A newly-created resource is always not-unknown.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
valid
protected final handle instProc
private java.lang.String type
private java.lang.Long id
null
until the ID is requested via
handle.resourceId(com.goldencode.p2j.util.WrappedResource)
public HandleResource()
protected HandleResource(boolean dynamic)
The resource's type is determined from a LegacyResource
annotation, which is
searched in these locations, in this order:
LegacyResource
annotation; if there is more than annotated interface, then n
IllegalStateException
is thrown.dynamic
- Flag indicating if this is a static or dynamic resource.java.lang.IllegalStateException
- If the resource type could not be determined from a LegacyResource
annotation, after checking the interface hierarchy, or more than one interface
is annotated.public java.lang.Long id()
id
in interface WrappedResource
null
if not set.public void id(long id)
id
in interface WrappedResource
id
- The resource's ID.public character getResourceType()
getResourceType
in interface CommonHandle
public boolean unknown()
unknown
in interface WrappedResource
false
public void readOnlyError(java.lang.String attr)
readOnlyError
in interface CommonHandle
attr
- The read-only attribute.public java.lang.String type()
public handle instantiatingProcedure()
The returned handle will refer a valid external procedure (persistent or not) or will be unknown, in case its instantiating procedure was persistent and has been deleted.
instantiatingProcedure
in interface InstantiatingProcedure
protected void invalidAttribute(java.lang.String attr)
attr
- The not-supported attribute attribute.protected boolean implicitDeletion()
true
if the INSTANTIATING-PROCEDURE attribute is unknown (i.e. the
instantiating procedure has been deleted) and we are during finalizable or
scopeable notification.protected void setInstantiatingProcedure(handle hproc)
hproc
- The procedure where the resource was instantiated.