1 29 30 package com.caucho.bytecode; 31 32 import com.caucho.util.CharBuffer; 33 34 37 abstract public class JMethod extends JAccessibleObject { 38 41 abstract public String getName(); 42 43 46 abstract public boolean isStatic(); 47 48 51 abstract public boolean isPrivate(); 52 53 56 abstract public boolean isPublic(); 57 58 61 abstract public boolean isAbstract(); 62 63 66 abstract public boolean isFinal(); 67 68 71 abstract public JClass getDeclaringClass(); 72 73 76 abstract public JClass getReturnType(); 77 78 81 abstract public JType getGenericReturnType(); 82 83 86 abstract public JClass []getParameterTypes(); 87 88 91 abstract public JClass []getExceptionTypes(); 92 93 96 abstract public JAnnotation []getDeclaredAnnotations(); 97 98 101 public String getFullName() 102 { 103 CharBuffer name = new CharBuffer(); 104 105 name.append(getName()); 106 name.append("("); 107 108 JClass []params = getParameterTypes(); 109 for (int i = 0; i < params.length; i++) { 110 if (i != 0) 111 name.append(", "); 112 113 name.append(params[i].getShortName()); 114 } 115 116 name.append(')'); 117 118 return name.toString(); 119 } 120 121 124 public boolean equals(Object o) 125 { 126 if (o == this) 127 return true; 128 else if (o == null || getClass() != o.getClass()) 129 return false; 130 131 JMethod jMethod = (JMethod) o; 132 133 if (! getName().equals(jMethod.getName())) 135 return false; 136 137 JClass []aParam = getParameterTypes(); 138 JClass []bParam = jMethod.getParameterTypes(); 139 140 if (aParam.length != bParam.length) 141 return false; 142 143 for (int i = 0; i < aParam.length; i++) { 144 if (aParam[i] == bParam[i]) 145 continue; 146 else if (aParam[i] == null || bParam[i] == null) 147 return false; 148 else if (! aParam[i].equals(bParam[i])) 149 return false; 150 } 151 152 return true; 153 } 154 155 public String toString() 156 { 157 return "JMethod[" + getName() + "]"; 158 } 159 } 160 | Popular Tags |