-
-

Critical Fields in Expressions

+
+

Fundamental Fields in Expressions

There is a very fundamental class Advice for the expressions used in filtering, tracing or monitoring and other aspects in commands.

public class Advice {
 
@@ -212,11 +212,12 @@
     private final boolean isBefore;
     private final boolean isThrow;
     private final boolean isReturn;
-    ...
+    
     // getter/setter  
 }  
 
+

Description for the variables in the class Advice:

@@ -227,52 +228,50 @@ - + - + - + - + - + - + - + - + - + - + -
loaderclass loader of the classthe class loader for the current called class
clazzthe reference of the classthe reference to the current called class
methodthe reflective reference of the methodthe reference to the current called method
targetthe instance of the classthe instance of the current called class
paramsthe parameters of the method, which is an array (when there is no argument in the method, it will be an empty array)the parameters for the current call, which is an array (when there's no parameter, it will be an empty array)
returnObjthe return value of the method - only when isReturn==true, it's a valid result but if the return value is void then it will be a nullthe return value from the current call - only available when the method call returns normally (isReturn==true), and null is for void return value
throwExpthe exceptions thrown by the method invoking - only when isThrow==true, it's a valid thrown exceptionthe exceptions thrown from the current call - only available when the method call throws exception (isThrow==true)
isBeforeassistant checking flag used in before-watching point and at this very moment: isBefore==true, isThrow==false and isReturn==false since it's before we invoke the methodflag to indicate the method is about to execute. isBefore==true but isThrow==false and isReturn==false since it's no way to know how the method call will end
isThrowassistant checking flag: whether the current method invoking ends with exceptionsflag to indicate the method call ends with exception thrown
isReturnassistant checking flag: whether the method invoking exits normally without exceptionsflag to indicate the method call ends normally without exception thrown

F.Y.I

-
    -
  1. all the fields mentioned in the table above can be used directly in the expressions;
  2. -
  3. if the expressions are invalid OGNL, the command will be cancelled automatically with hints to correct the expressions;
  4. +

    All variables listed above can be used directly in the OGNL expression. The command will not execute and exit if there’s illegal OGNL grammar or unexpected variable in the expression.

    +
+