1 22 package org.jboss.aop.advice; 23 24 import java.lang.reflect.Method ; 25 import java.util.ArrayList ; 26 27 import javassist.CtClass; 28 import javassist.CtMethod; 29 import javassist.NotFoundException; 30 31 37 public class AdviceMethodProperties 38 { 39 public static final Integer JOINPOINT_ARG = new Integer (-1); 40 public static final Integer INVOCATION_ARG = new Integer (-2); 41 public static final Integer RETURN_ARG = new Integer (-3); 42 public static final Integer THROWABLE_ARG = new Integer (-4); 43 44 public static final CtClass[] EMPTY_PARAMETERS = {}; 45 46 private Class aspectClass; 48 private String adviceName; 49 private Class infoType; 50 private Class invocationType; 51 private Class joinpointReturnType; 52 private Class [] joinpointParameters; 53 private Class [] joinpointExceptions; 54 55 private Method adviceMethod; 57 private Integer [] args; 58 59 public AdviceMethodProperties( 60 Class aspectClass, 61 String adviceName, 62 Class infoType, 63 Class invocationType, 64 Class joinpointReturnType, 65 Class [] joinpointParameters, 66 Class [] joinpointExceptions) 67 { 68 this.aspectClass = aspectClass; 69 this.adviceName = adviceName; 70 this.infoType = infoType; 71 this.invocationType = invocationType; 72 this.joinpointReturnType = joinpointReturnType; 73 this.joinpointParameters = joinpointParameters; 74 this.joinpointExceptions = joinpointExceptions; 75 } 76 77 public void setFoundProperties(Method adviceMethod, ArrayList args) 78 { 79 this.adviceMethod = adviceMethod; 80 this.args = (Integer [])args.toArray(new Integer [args.size()]); 81 } 82 83 public String getAdviceName() 84 { 85 return adviceName; 86 } 87 88 89 public Class getAspectClass() 90 { 91 return aspectClass; 92 } 93 94 95 public Class getInfoType() 96 { 97 return infoType; 98 } 99 100 101 public Class getInvocationType() 102 { 103 return invocationType; 104 } 105 106 107 public Class [] getJoinpointExceptions() 108 { 109 return joinpointExceptions; 110 } 111 112 113 public Class [] getJoinpointParameters() 114 { 115 return joinpointParameters; 116 } 117 118 119 public Class getJoinpointReturnType() 120 { 121 return joinpointReturnType; 122 } 123 124 public boolean isAdviceVoid() throws NotFoundException 125 { 126 return adviceMethod.getReturnType().equals(CtClass.voidType); 127 } 128 129 public Method getAdviceMethod() 130 { 131 return adviceMethod; 132 } 133 134 public Integer [] getArgs() 135 { 136 return args; 137 } 138 139 } 140 | Popular Tags |