[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

Variables Index

O inspectResult
This Result indicates that a MetaObject intends to observe but not to modify the Result of an
O inspectResultMode
This Result mode indicates that a MetaObject intends to observe but not to modify the Result
O modifyResult
This Result indicates that a MetaObject intends to inspect the Result of an Operation and
O modifyResultMode
This Result mode indicates that a MetaObject intends to inspect the Result of an Operation
O noResult
This Result indicates that a MetaObject does not care about the Result of an Operation
O noResultMode
This Result mode indicates that a MetaObject does not care about the Result of an
O resultRequestMask
This variable is to be used as a mask to select either noResultMode, inspectResultMode or
O resultValueMask
This variable is to be used as a mask to select either returnedValue or thrownValue.
O returnedValue
This Result mode indicates that the Result contains a value that is to be considered the
O thrownValue
This Result mode indicates that the Result contains a value that is to be considered as

Methods

O getBooleanValue()
Obtains the returned value from the Operation.
O getByteValue()
Obtains the returned value from the Operation.
O getCharValue()
Obtains the returned value from the Operation.
O getDoubleValue()
Obtains the returned value from the Operation.
O getFloatValue()
Obtains the returned value from the Operation.
O getIntValue()
Obtains the returned value from the Operation.
O getLongValue()
Obtains the returned value from the Operation.
O getMode()
This method obtains the mode of the Result
O getObjectValue()
Obtains the returned or thrown Object, suitably wrapped if it is a primitive type.
O getOperation()
Obtains the Operation the Result refers to
O getShortValue()
Obtains the returned value from the Operation.
O isException()
Checks whether the Result was an Exception
O operation(Operation, int)
Creates an Operation replacement Result, unless the given Operation is null.
O returnBoolean(boolean, Operation)
Builds the Result of the Operation.
O returnByte(byte, Operation)
Builds the Result of the Operation.
O returnChar(char, Operation)
Builds the Result of the Operation.
O returnDouble(double, Operation)
Builds the Result of the Operation.
O returnFloat(float, Operation)
Builds the Result of the Operation.
O returnInt(int, Operation)
Builds the Result of the Operation.
O returnLong(long, Operation)
Wraps the first argument into the appropriate wrapper class and calls returnObject.
O returnObject(Object, Operation)
Builds the Result of the Operation.
O returnShort(short, Operation)
Builds the Result of the Operation.
O returnVoid(Operation)
Builds the Result of the Operation.
O throwObject(Throwable, Operation)
Builds the Result of the Operation.
O toString()
Returns a String representation of the Result.

Variables

O 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

O 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

O 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

O resultRequestMask

public static final int resultRequestMask;
This variable is to be used as a mask to select either noResultMode, inspectResultMode or modifyResultMode.

O 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.

O 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.

O resultValueMask

public static final int resultValueMask;
This variable is to be used as a mask to select either returnedValue or thrownValue.

O 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.

O 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.

O 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.

Methods

O 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.

O 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.

O 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.

O 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.

O 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.

O 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.

O 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.

O 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.

O 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.

O 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.

O 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.

O 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.

O 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.

O 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.

O 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.

O 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.

O 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.

O 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.

O 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.

O 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.

O 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.

O 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.

O 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.

O 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.

O 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