[all packages]
[package BR.unicamp.Guarana]
[class hierarchy]
[index]
public final class BR.unicamp.Guarana.Operation
(source file: /home/lsd/oliva/src/java/guarana/kaffe/libraries/extensions/guarana/javalib/BR/unicamp/Guarana/Operation.java)
java.lang.Object
|
+----BR.unicamp.Guarana.Operation
The pure class interface.
public final class Operation
- A meta-level representation of an Operation. There are only two
ways an Operation can be created: it is either reified from the
base level or created by an OperationFactory.
- See also:
- OperationFactory
- array
- If ((op.getOpType() & Operation.array) != 0), op is
either an array element
- arrayLength
- If (op.getOpType() == Operation.arrayLength), op is an
array length Operation.
- arrayMask
- If ((op.getOpType() & Operation.arrayMask) ==
Operation.array), op is either an
- arrayRead
- If (op.getOpType() == arrayRead), op is an array
element read Operation.
- arrayWrite
- If (op.getOpType() == arrayWrite), op is an array
element write Operation.
- constructorInvocation
- If (op.getOpType() ==
Operation.constructorInvocation), op is a
- field
- If ((op.getOpType() & Operation.field) != 0), op is
either a field read or a
- fieldRead
- If (op.getOpType() == fieldRead), op is a field read
Operation.
- fieldWrite
- If (op.getOpType() == fieldWrite), op is a field write
Operation.
- invocation
- If ((op.getOpType() & Operation.invocation) != 0),
op is either a method or a
- methodInvocation
- If (op.getOpType() == Operation.methodInvocation), op
is a method invocation.
- monitorEnter
- If (op.getOpType() == Operation.monitorEnter), op is a
monitor enter Operation.
- monitorExit
- If (op.getOpType() == Operation.monitorExit), op is a
monitor exit Operation.
- nop
- If (op.getOpType() == nop), op is a do-nothing
operation.
- read
- If ((op.getOpType() & Operation.readWriteMask) ==
Operation.read), op is either
- readWriteMask
- Should be used as a bit mask to check whether an operation is a
read operation or a write
- synchronization
- If ((op.getOpType() & Operation.synchronization) !=
0), op is either a monitor
- write
- If ((op.getOpType() & Operation.readWriteMask) ==
Operation.write), op is either
- getArguments()
- Obtains the argument list to be used when invoking a Method or a
Constructor
- getArrayIndex()
- Obtains the array index this Operation reads from or writes to.
- getConstructor()
- Obtains the constructor that will be invoked by this Operation.
- getField()
- Obtains the Field this Operation reads from or writes to.
- getMetaObjectInfo(MetaObject)
- Obtains MetaObject-specific information previously stored by
setMetaObjectInfo().
- getMethod()
- Obtains the method that will be invoked by this Operation.
- getObject()
- Obtains the target Object of the Operation.
- getOpType()
- Obtains a numeric value that may be used to check whether the
Operation is a method or
- getOriginal()
- Obtains the original Operation from a replacement chain
- getReplaced()
- Obtains the Operation this Operation replaced.
- getThread()
- Obtains the Thread in which this Operation is to be executed.
- getType()
- Obtains the expected type of the result of an Operation.
Constructor invocations and
- getValue()
- Obtains the value that will be written to the Field or Array
element.
- isArrayLengthOperation()
- Checks whether this is an Array length Operation.
- isArrayOperation()
- Checks whether this is an Array element read or write Operation.
- isClassOperation()
- Checks whether the Operation is a static method invocation or
static field access.
- isConstructorInvocation()
- Checks whether this is a constructor invocation Operation.
- isFieldOperation()
- Checks whether this is a field Operation
- isMethodInvocation()
- Checks whether this is a method invocation Operation.
- isMonitorEnter()
- Checks whether this is a monitor enter Operation.
- isMonitorExit()
- Checks whether this is a monitor exit Operation.
- isReadOperation()
- Checks whether this is a field or array element read or array
length Operation.
- isReplacement()
- Checks whether this is a replacement Operation.
- isSynchronization()
- Checks whether this is a synchronization Operation.
- isWriteOperation()
- Checks whether this is a field or array element write Operation.
- perform()
- Just an alternate way of calling Guarana.perform(this).
- replaced(Operation)
- Checks whether an Operation is the same as or a replacement of
the given Operation.
- setMetaObjectInfo(MetaObject, Object)
- Stores MetaObject-specific information in the Operation
- toString()
- Returns a String representation of the Operation.
- validate()
- Checks whether it is a valid Operation, that is, one that can be
performed.
nop
public static final int nop;
- If (op.getOpType() == nop), op is a do-nothing
operation.
invocation
public static final int invocation;
- If ((op.getOpType() & Operation.invocation) != 0),
op is either a method or a constructor invocation.
methodInvocation
public static final int methodInvocation;
- If (op.getOpType() == Operation.methodInvocation), op
is a method invocation.
constructorInvocation
public static final int constructorInvocation;
- If (op.getOpType() ==
Operation.constructorInvocation), op is a constructor
invocation.
synchronization
public static final int synchronization;
- If ((op.getOpType() & Operation.synchronization) !=
0), op is either a monitor enter or a monitor exit
Operation.
monitorEnter
public static final int monitorEnter;
- If (op.getOpType() == Operation.monitorEnter), op is a
monitor enter Operation.
monitorExit
public static final int monitorExit;
- If (op.getOpType() == Operation.monitorExit), op is a
monitor exit Operation.
read
public static final int read;
- If ((op.getOpType() & Operation.readWriteMask) ==
Operation.read), op is either a field read, an array
element read or an array length Operation.
write
public static final int write;
- If ((op.getOpType() & Operation.readWriteMask) ==
Operation.write), op is either a field write or an array
element write Operation.
readWriteMask
public static final int readWriteMask;
- Should be used as a bit mask to check whether an operation is a
read operation or a write operation. If ((op.getOpType()
& Operation.readWriteMask) == 0), op is neither a read
nor a write Operation.
field
public static final int field;
- If ((op.getOpType() & Operation.field) != 0), op is
either a field read or a field write Operation.
array
public static final int array;
- If ((op.getOpType() & Operation.array) != 0), op is
either an array element read, an array element write or an array
length Operation.
arrayMask
public static final int arrayMask;
- If ((op.getOpType() & Operation.arrayMask) ==
Operation.array), op is either an array element read or an
array element write Operation.
arrayLength
public static final int arrayLength;
- If (op.getOpType() == Operation.arrayLength), op is an
array length Operation.
fieldRead
public static final int fieldRead;
- If (op.getOpType() == fieldRead), op is a field read
Operation.
fieldWrite
public static final int fieldWrite;
- If (op.getOpType() == fieldWrite), op is a field write
Operation.
arrayRead
public static final int arrayRead;
- If (op.getOpType() == arrayRead), op is an array
element read Operation.
arrayWrite
public static final int arrayWrite;
- If (op.getOpType() == arrayWrite), op is an array
element write Operation.
perform
public Result perform();
- Just an alternate way of calling Guarana.perform(this).
- Returns:
- the Result of the Operation.
- See also:
- perform
validate
public native void validate()
throws NoSuchMethodError, AbstractMethodError, IllegalArgumentException, NoSuchFieldError, ArrayIndexOutOfBoundsException;
- Checks whether it is a valid Operation, that is, one that can be
performed.
- Throws:
- NoSuchMethodError -if the target Object is not
an instance of the Class that declares the Method or the
Constructor.
- AbstractMethodError -if the Method is abstract.
- IllegalArgumentException -if the argument types do not
match the Method or Constructor signature, or the number of
arguments does not match.
- NoSuchFieldError -if the target Object is not an
instance of the Class that declares the Field.
- IllegalArgumentException -if the value to be stored in
the Field or array element is not assignable to the Field type.
- IllegalArgumentException -if the target Object is not
an Array, but the Operation is an Array Operation.
- ArrayIndexOutOfBoundsException -if the specified array
element does not exist.
-
getObject
public native Object getObject();
- Obtains the target Object of the Operation.
- Returns:
- the target Object.
getThread
public native Thread getThread();
- Obtains the Thread in which this Operation is to be executed.
- Returns:
- the Thread that should execute this Operation.
getType
public native Class getType();
- Obtains the expected type of the result of an Operation.
Constructor invocations and synchronization operations, as well
as field and array element write operations, are assumed to
return void. Array length Operations always return int.
- Returns:
- the type the Operation is expected to Result under
normal control flow.
isClassOperation
public native boolean isClassOperation();
- Checks whether the Operation is a static method invocation or
static field access.
Note: synchronization Operations are never considered static,
since an invocation of a synchronized static method enters the
monitor associated with the Class object that represents the
class.
- Returns:
- true if and only if the method to be invoked or the
field to be accessed is static.
getOpType
public native int getOpType();
- Obtains a numeric value that may be used to check whether the
Operation is a method or constructor invocation, a
synchronization Operation, a field or
array element read or write Operation, or an array length
Operation.
isMethodInvocation
public native boolean isMethodInvocation();
- Checks whether this is a method invocation Operation.
- Returns:
- true if and only if this is a method invocation
Operation.
getMethod
public native Method getMethod();
- Obtains the method that will be invoked by this Operation.
- Returns:
- the method to be invoked, or null if this is not a
method invocation Operation.
isConstructorInvocation
public native boolean isConstructorInvocation();
- Checks whether this is a constructor invocation Operation.
- Returns:
- true if and only if this is a constructor invocation
Operation.
getConstructor
public native Constructor getConstructor();
- Obtains the constructor that will be invoked by this Operation.
- Returns:
- the constructor to be invoked, or null if this is not a
constructor invocation Operation.
getArguments
public native Object[] getArguments();
- Obtains the argument list to be used when invoking a Method or a
Constructor. Changing the references in the returned array has
no effect on the invocation, but the references are to the
actual arguments, so any Operation that changes such Objects
will affect the actual invocation.
- Returns:
- the argument list that will be passed to the Method or
to the Constructor, as an array of Objects, or null if this is
not a Method nor Constructor invocation Operation.
isSynchronization
public native boolean isSynchronization();
- Checks whether this is a synchronization Operation.
- Returns:
- true if and only if this is a synchronization
Operation.
isMonitorEnter
public native boolean isMonitorEnter();
- Checks whether this is a monitor enter Operation.
- Returns:
- true if and only if this is a monitor enter Operation.
isMonitorExit
public native boolean isMonitorExit();
- Checks whether this is a monitor exit Operation.
- Returns:
- true if and only if this is a monitor exit Operation.
isReadOperation
public native boolean isReadOperation();
- Checks whether this is a field or array element read or array
length Operation.
- Returns:
- true if and only if this is a field or array element
read or array length Operation.
isWriteOperation
public native boolean isWriteOperation();
- Checks whether this is a field or array element write Operation.
- Returns:
- true if and only if this is a field or array element
change Operation.
isFieldOperation
public native boolean isFieldOperation();
- Checks whether this is a field Operation. Array Operations are
not considered Field Operations
- Returns:
- true if and only if this is a field Operation.
getField
public native Field getField();
- Obtains the Field this Operation reads from or writes to.
- Returns:
- the Field, or null if this is not a Field Operation.
isArrayOperation
public native boolean isArrayOperation();
- Checks whether this is an Array element read or write Operation.
- Returns:
- true if and only if this is an Array element read or
write Operation.
isArrayLengthOperation
public native boolean isArrayLengthOperation();
- Checks whether this is an Array length Operation.
- Returns:
- true if and only if this is the Operation that obtains
the length of an Array.
getArrayIndex
public native int getArrayIndex();
- Obtains the array index this Operation reads from or writes to.
- Returns:
- the array index, or -1 if this is not an array
Operation.
getValue
public native Object getValue();
- Obtains the value that will be written to the Field or Array
element.
- Returns:
- the value to be written, or null if this is not a
Write Operation. The only way to distinguish between a
non-Write Operation and a null value to be written is by
invoking isWriteOperation().
- See also:
- isWriteOperation
isReplacement
public native boolean isReplacement();
- Checks whether this is a replacement Operation.
- Returns:
- true if and only if this is a replacement Operation.
getReplaced
public native Operation getReplaced();
- Obtains the Operation this Operation replaced.
- Returns:
- a reference to the replaced Operation, or null if this
is not a replacement one.
replaced
public boolean replaced(Operation operation);
- Checks whether an Operation is the same as or a replacement of
the given Operation.
- Parameters:
- operation - the Operation that should be looked for in the
replacement chain.
- Returns:
- true if the Operation is found, false otherwise.
getOriginal
public Operation getOriginal();
- Obtains the original Operation from a replacement chain. That
is, if Operation n replaced Operation n-1 that replaced
Operation n-2 ... that replaced Operation 1, obtain Operation 1.
- Returns:
- the last Operation in a replacement chain.
setMetaObjectInfo
public Object setMetaObjectInfo(MetaObject metaObject,
Object object);
- Stores MetaObject-specific information in the Operation. A
previously-stored Object can be obtained with
getMetaObjectInfo().
- Parameters:
- metaObject - the MetaObject with which the Object is
associated.
- object - the Object to be associated with the
MetaObject.
- Returns:
- the Object previously associated with metaObject, or
null.
- See also:
- getMetaObjectInfo
getMetaObjectInfo
public Object getMetaObjectInfo(MetaObject metaObject);
- Obtains MetaObject-specific information previously stored by
setMetaObjectInfo().
- Parameters:
- metaObject - the MetaObject whose associated Object is to
be returned.
- Returns:
- the Object previously associated with metaObject, or
null.
- See also:
- setMetaObjectInfo
toString
public String toString();
- Returns a String representation of the Operation.
- Throws:
- IllegalArgumentException -if getOpType()
returns an invalid Operation type.
-
- Overrides:
- toString in class Object
[all packages]
[package BR.unicamp.Guarana]
[class hierarchy]
[index]
BR.unicamp.Guarana.Operation.html