|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface IIfClosure
IIfClosure - Interface for if-closures which are to be evaluated at runtime.
An if-closure evaluates a boolean expression under some given bindings.
This is used in order to evaluate if-pointcuts in the right context.
A typical example may be:
new IIfClosure() {
public boolean satisfiedUnderBindings(
WeakValuesMap currentBindings) {
try {
final Integer j = (Integer) currentBindings
.get("j");
final Integer i = (Integer) currentBindings
.get("i");
try {
return j != i;
} catch (java.lang.Exception ex) {
throw new IIfClosure.UserCausedException(
ex, "j != i");
}
} catch (java.lang.NullPointerException ex) {
return false;
} catch (java.lang.ClassCastException ex) {
return false;
}
}
public java.lang.String[] variableNames() {
return new java.lang.String[] { "j", "i" };
}
public java.lang.String toString() {
return "j != i";
}
}
}
| Nested Class Summary | |
|---|---|
static class |
IIfClosure.UserCausedException
UserCausedException - An exception that wraps exceptions caused by the evaluation of an IfClosure. |
| Method Summary | |
|---|---|
boolean |
satisfiedUnderBindings(WeakValuesMap<String,Object> currentBinding)
Evaluates the given booelan expression under the given bindings. |
String |
toString()
Clients should implement this for debugging purposes. |
String[] |
variableNames()
Returns all variables required to evaluate this closure. |
| Method Detail |
|---|
boolean satisfiedUnderBindings(WeakValuesMap<String,Object> currentBinding)
throws IIfClosure.UserCausedException
currentBinding - the binding to evaluate under
true if the expression is satisfied, false otherwise
IIfClosure.UserCausedException - thrown if the boolean expression caused an exception;
the originally exception is wrapped in the IIfClosure.UserCausedException and can be extracted
using Throwable.getCause(). The expression that caused the exception can be retrieved
by IIfClosure.UserCausedException.getIfExpression() in String form.String[] variableNames()
String toString()
toString in class ObjectObject.toString()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||