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