1 22 package org.jboss.aspects.dbc.condition; 23 24 import java.lang.reflect.Method ; 25 26 import org.jboss.aop.joinpoint.Invocation; 27 28 33 public class MethodCondition extends ExecutableCondition 34 { 35 Method method; 36 37 public MethodCondition(Method method, String condExpr, boolean staticCall) 38 { 39 super(condExpr, method.getClass(), staticCall); 40 this.method = method; 41 } 42 43 public boolean equals(Object o) 44 { 45 if (o instanceof MethodCondition) 46 { 47 MethodCondition mc = (MethodCondition)o; 48 if (mc.method.equals(method)) 49 { 50 return super.equals(o); 51 } 52 } 53 return false; 54 } 55 56 protected Object executableObject() 58 { 59 return method; 60 } 61 62 protected Class [] parameterTypes() 63 { 64 return method.getParameterTypes(); 65 } 66 67 protected boolean isPredefinedToken(String token) 68 { 69 return token.equals(Condition.TARGET) || token.equals(Condition.RETURN); 70 } 71 72 protected Object getValueForPredefinedToken(Invocation invocation, Object rtn, String token) 73 { 74 if (token.equals(Condition.TARGET)) 75 { 76 return getTarget(invocation, isStatic); 77 } 78 else if (token.equals(Condition.RETURN)) 79 { 80 return rtn; 81 } 82 83 return null; 84 } 85 } 86 | Popular Tags |