[all packages]
[package BR.unicamp.Guarana]
[class hierarchy]
[index]
public final class BR.unicamp.Guarana.Result
(source file: /home/lsd/oliva/src/java/guarana/kaffe/libraries/extensions/guarana/javalib/BR/unicamp/Guarana/Result.java)
java.lang.Object
|
+----BR.unicamp.Guarana.Result
The pure class interface.
public final class Result
- A Result object is used as the return value of a request to a
MetaObject to Handle an Operation or another Result. It may
contain a Result to be used as the result of the Operation. If no
Result is given, it may provide an Operation to be performed
instead of the one it was requested to handle (unless it was asked
to handle a Result already). Even if such an Operation is not
provided, a request to inspect or even to modify the Result of the
Operation, after it is performed, may be included in the Result
(again, only for request to handle Operations). A null Result
should be interpreted as a noResult.
When a MetaObject is asked to handle a Result, and it returns
another Result that does not contain a returned or thrown value,
the Result it returns is simply discarded.
- See also:
- handle
- inspectResult
- This Result indicates that a MetaObject intends to observe but
not to modify the Result of an
- inspectResultMode
- This Result mode indicates that a MetaObject intends to observe
but not to modify the Result
- modifyResult
- This Result indicates that a MetaObject intends to inspect the
Result of an Operation and
- modifyResultMode
- This Result mode indicates that a MetaObject intends to inspect
the Result of an Operation
- noResult
- This Result indicates that a MetaObject does not care about the
Result of an Operation
- noResultMode
- This Result mode indicates that a MetaObject does not care about
the Result of an
- resultRequestMask
- This variable is to be used as a mask to select either
noResultMode, inspectResultMode or
- resultValueMask
- This variable is to be used as a mask to select either
returnedValue or thrownValue.
- returnedValue
- This Result mode indicates that the Result contains a value that
is to be considered the
- thrownValue
- This Result mode indicates that the Result contains a value that
is to be considered as
- getBooleanValue()
- Obtains the returned value from the Operation.
- getByteValue()
- Obtains the returned value from the Operation.
- getCharValue()
- Obtains the returned value from the Operation.
- getDoubleValue()
- Obtains the returned value from the Operation.
- getFloatValue()
- Obtains the returned value from the Operation.
- getIntValue()
- Obtains the returned value from the Operation.
- getLongValue()
- Obtains the returned value from the Operation.
- getMode()
- This method obtains the mode of the Result
- getObjectValue()
- Obtains the returned or thrown Object, suitably wrapped if it is
a primitive type.
- getOperation()
- Obtains the Operation the Result refers to
- getShortValue()
- Obtains the returned value from the Operation.
- isException()
- Checks whether the Result was an Exception
- operation(Operation, int)
- Creates an Operation replacement Result, unless the given
Operation is null.
- returnBoolean(boolean, Operation)
- Builds the Result of the Operation.
- returnByte(byte, Operation)
- Builds the Result of the Operation.
- returnChar(char, Operation)
- Builds the Result of the Operation.
- returnDouble(double, Operation)
- Builds the Result of the Operation.
- returnFloat(float, Operation)
- Builds the Result of the Operation.
- returnInt(int, Operation)
- Builds the Result of the Operation.
- returnLong(long, Operation)
- Wraps the first argument into the appropriate wrapper class and
calls returnObject.
- returnObject(Object, Operation)
- Builds the Result of the Operation.
- returnShort(short, Operation)
- Builds the Result of the Operation.
- returnVoid(Operation)
- Builds the Result of the Operation.
- throwObject(Throwable, Operation)
- Builds the Result of the Operation.
- toString()
- Returns a String representation of the Result.
noResultMode
public static final int noResultMode;
- This Result mode indicates that a MetaObject does not care about
the Result of an Operation.
- See also:
- noResult
inspectResultMode
public static final int inspectResultMode;
- This Result mode indicates that a MetaObject intends to observe
but not to modify the Result of an Operation.
- See also:
- inspectResult
modifyResultMode
public static final int modifyResultMode;
- This Result mode indicates that a MetaObject intends to inspect
the Result of an Operation and possibly replace it with another
Result.
- See also:
- modifyResult
resultRequestMask
public static final int resultRequestMask;
- This variable is to be used as a mask to select either
noResultMode, inspectResultMode or modifyResultMode.
returnedValue
public static final int returnedValue;
- This Result mode indicates that the Result contains a value that
is to be considered the return value of the Operation.
thrownValue
public static final int thrownValue;
- This Result mode indicates that the Result contains a value that
is to be considered as thrown from the execution of the
Operation.
resultValueMask
public static final int resultValueMask;
- This variable is to be used as a mask to select either
returnedValue or thrownValue.
noResult
public static final Result noResult;
- This Result indicates that a MetaObject does not care about the
Result of an Operation. Composers are allowed to handle
noResult as inspectResult or modifyResult. A null Result
should be interpreted as a noResult request.
inspectResult
public static final Result inspectResult;
- This Result indicates that a MetaObject intends to observe but
not to modify the Result of an Operation. Composers are allowed
to handle inspectResult as modifyResult.
modifyResult
public static final Result modifyResult;
- This Result indicates that a MetaObject intends to inspect the
Result of an Operation and possibly replace it with another
Result.
operation
public static native Result operation(Operation operation,
int nmode);
- Creates an Operation replacement Result, unless the given
Operation is null.
- Parameters:
- operation - the replacement Operation.
- mode - either noResultMode, inspectResultMode or
modifyResultMode.
- Returns:
- a new Operation replacement Result, or either noResult,
inspectResult or modifyResult, if the given Operation is null.
returnObject
public static native Result returnObject(Object returned,
Operation operation)
throws IllegalArgumentException;
- Builds the Result of the Operation.
- Parameters:
- returned - contains the returned value of the Operation.
It must be wrapped into a suitable wrapper class, if it is
supposed to be a primitive type. Helper methods are available.
- operation - is the Operation this Result refers to.
- Returns:
- a Result containing the returned value.
- Throws:
- IllegalArgumentException -if the value does not have
the expected type.
-
returnBoolean
public static native Result returnBoolean(boolean returned,
Operation operation)
throws IllegalArgumentException;
- Builds the Result of the Operation.
- Parameters:
- returned - contains the returned value of the Operation.
- operation - is the Operation this Result refers to.
- Returns:
- a Result containing the returned value.
- Throws:
- IllegalArgumentException -if the value does not have
the expected type.
-
returnByte
public static native Result returnByte(byte returned,
Operation operation)
throws IllegalArgumentException;
- Builds the Result of the Operation.
- Parameters:
- returned - contains the returned value of the Operation.
- operation - is the Operation this Result refers to.
- Returns:
- a Result containing the returned value.
- Throws:
- IllegalArgumentException -if the value does not have
the expected type.
-
returnShort
public static native Result returnShort(short returned,
Operation operation)
throws IllegalArgumentException;
- Builds the Result of the Operation.
- Parameters:
- returned - contains the returned value of the Operation.
- operation - is the Operation this Result refers to.
- Returns:
- a Result containing the returned value.
- Throws:
- IllegalArgumentException -if the value does not have
the expected type.
-
returnInt
public static native Result returnInt(int returned,
Operation operation)
throws IllegalArgumentException;
- Builds the Result of the Operation.
- Parameters:
- returned - contains the returned value of the Operation.
- operation - is the Operation this Result refers to.
- Returns:
- a Result containing the returned value.
- Throws:
- IllegalArgumentException -if the value does not have
the expected type.
-
returnLong
public static native Result returnLong(long returned,
Operation operation)
throws IllegalArgumentException;
- Wraps the first argument into the appropriate wrapper class and
calls returnObject.
- Parameters:
- returned - contains the returned value of the Operation.
- operation - is the Operation this Result refers to.
- Returns:
- a Result containing the returned value.
- Throws:
- IllegalArgumentException -if the value does not have
the expected type.
-
returnFloat
public static native Result returnFloat(float returned,
Operation operation)
throws IllegalArgumentException;
- Builds the Result of the Operation.
- Parameters:
- returned - contains the returned value of the Operation.
- operation - is the Operation this Result refers to.
- Returns:
- a Result containing the returned value.
- Throws:
- IllegalArgumentException -if the value does not have
the expected type.
-
returnDouble
public static native Result returnDouble(double returned,
Operation operation)
throws IllegalArgumentException;
- Builds the Result of the Operation.
- Parameters:
- returned - contains the returned value of the Operation.
- operation - is the Operation this Result refers to.
- Returns:
- a Result containing the returned value.
- Throws:
- IllegalArgumentException -if the value does not have
the expected type.
-
returnChar
public static native Result returnChar(char returned,
Operation operation)
throws IllegalArgumentException;
- Builds the Result of the Operation.
- Parameters:
- returned - contains the returned value of the Operation.
- operation - is the Operation this Result refers to.
- Returns:
- a Result containing the returned value.
- Throws:
- IllegalArgumentException -if the value does not have
the expected type.
-
returnVoid
public static native Result returnVoid(Operation operation)
throws IllegalArgumentException;
- Builds the Result of the Operation.
- Parameters:
- returned - contains the returned value of the Operation.
- operation - is the Operation this Result refers to.
- Returns:
- a Result containing the returned value.
- Throws:
- IllegalArgumentException -if the value does not have
the expected type.
-
throwObject
public static Result throwObject(Throwable thrown,
Operation operation)
throws IllegalArgumentException;
- Builds the Result of the Operation.
- Parameters:
- thrown - is the Throwable to be considered the exceptional
Result of the Operation.
- operation - is the Operation this Result refers to.
- Returns:
- a Result containing the Throwable value.
- Throws:
- IllegalArgumentException -if the given Throwable is
neither a Error nor a RuntimeException, nor does it match the
exception declaration of the given Operation, if it is a
constructor or method invocation.
-
getMode
public native int getMode();
- This method obtains the mode of the Result. It may be one of
noResultMode, inspectResultMode, modifyResultMode,
returnedValue or thrownValue.
- Returns:
- the mode of the Result.
getOperation
public native Operation getOperation();
- Obtains the Operation the Result refers to. If this Result is a
replacement Operation, the replacement Operation is returned.
If it contains a returned or thrown value, the Operation it
refers to is returned. Otherwise, it returns null.
- Returns:
- the Operation itself.
isException
public native boolean isException();
- Checks whether the Result was an Exception. This includes both
base-level and meta-level exceptions.
- Returns:
- true if and only if the Operation resulted an Exception,
or its handling caused an Exception in the meta-level.
getObjectValue
public native Object getObjectValue();
- Obtains the returned or thrown Object, suitably wrapped if it is
a primitive type.
- Returns:
- the Object thrown or returned by the Operation, or null
if this Result does not contain such a value or it was of void
type.
getBooleanValue
public native boolean getBooleanValue()
throws IllegalArgumentException;
- Obtains the returned value from the Operation.
- Returns:
- the result of the Operation.
- Throws:
- IllegalArgumentException -if the result type is not
the requested one, or no returned value is available.
-
getByteValue
public native byte getByteValue()
throws IllegalArgumentException;
- Obtains the returned value from the Operation.
- Returns:
- the result of the Operation.
- Throws:
- IllegalArgumentException -if the result type is not
the requested one, or no returned value is available.
-
getShortValue
public native short getShortValue()
throws IllegalArgumentException;
- Obtains the returned value from the Operation.
- Returns:
- the result of the Operation.
- Throws:
- IllegalArgumentException -if the result type is not
the requested one, or no returned value is available.
-
getIntValue
public native int getIntValue()
throws IllegalArgumentException;
- Obtains the returned value from the Operation.
- Returns:
- the result of the Operation.
- Throws:
- IllegalArgumentException -if the result type is not
the requested one, or no returned value is available.
-
getLongValue
public native long getLongValue()
throws IllegalArgumentException;
- Obtains the returned value from the Operation.
- Returns:
- the result of the Operation.
- Throws:
- IllegalArgumentException -if the result type is not
the requested one, or no returned value is available.
-
getCharValue
public native char getCharValue()
throws IllegalArgumentException;
- Obtains the returned value from the Operation.
- Returns:
- the result of the Operation.
- Throws:
- IllegalArgumentException -if the result type is not
the requested one, or no returned value is available.
-
getFloatValue
public native float getFloatValue()
throws IllegalArgumentException;
- Obtains the returned value from the Operation.
- Returns:
- the result of the Operation.
- Throws:
- IllegalArgumentException -if the result type is not
the requested one, or no returned value is available.
-
getDoubleValue
public native double getDoubleValue()
throws IllegalArgumentException;
- Obtains the returned value from the Operation.
- Returns:
- the result of the Operation.
- Throws:
- IllegalArgumentException -if the result type is not
the requested one, or no returned value is available.
-
toString
public String toString();
- Returns a String representation of the Result.
- Overrides:
- toString in class Object
[all packages]
[package BR.unicamp.Guarana]
[class hierarchy]
[index]
BR.unicamp.Guarana.Result.html