| Method from org.codehaus.groovy.reflection.CachedMethod Detail: |
public int compareTo(Object o) {
if (o instanceof CachedMethod)
return compareToCachedMethod((CachedMethod)o);
else
return compareToMethod((Method)o);
}
|
public CallSite createPogoMetaMethodSite(CallSite site,
MetaClassImpl metaClass,
Class[] params) {
if (!hasPogoCallSiteConstructor()) {
Constructor constr = null;
if (CallSiteGenerator.isCompilable(this)) {
constr = CallSiteGenerator.compilePogoMethod(this);
if (constr != null)
pogoCallSiteConstructor = new SoftReference< Constructor > (constr);
}
}
if (hasPogoCallSiteConstructor()) {
final Constructor constructor = pogoCallSiteConstructor.get();
if (constructor != null) {
try {
return (CallSite) constructor.newInstance(site, metaClass, this, params);
} catch (Throwable e) { //
}
}
}
return new PogoMetaMethodSite.PogoCachedMethodSiteNoUnwrapNoCoerce(site, metaClass, this, params);
}
|
public CallSite createPojoMetaMethodSite(CallSite site,
MetaClassImpl metaClass,
Class[] params) {
if (!hasPojoCallSiteConstructor()) {
Constructor constr = null;
if (CallSiteGenerator.isCompilable(this)) {
constr = CallSiteGenerator.compilePojoMethod(this);
if (constr != null)
pojoCallSiteConstructor = new SoftReference< Constructor > (constr);
}
}
if (hasPogoCallSiteConstructor()) {
final Constructor constructor = pojoCallSiteConstructor.get();
if (constructor != null) {
try {
return (CallSite) constructor.newInstance(site, metaClass, this, params);
} catch (Throwable e) { //
}
}
}
return new PojoMetaMethodSite.PojoCachedMethodSiteNoUnwrapNoCoerce(site, metaClass, this, params);
}
|
public CallSite createStaticMetaMethodSite(CallSite site,
MetaClassImpl metaClass,
Class[] params) {
if (!hasStaticCallSiteConstructor()) {
Constructor constr = null;
if (CallSiteGenerator.isCompilable(this)) {
constr = CallSiteGenerator.compileStaticMethod(this);
if (constr != null)
staticCallSiteConstructor = new SoftReference< Constructor > (constr);
}
}
if (hasStaticCallSiteConstructor()) {
final Constructor constructor = staticCallSiteConstructor.get();
if (constructor != null) {
try {
return (CallSite) constructor.newInstance(site, metaClass, this, params);
} catch (Throwable e) { //
}
}
}
return new StaticMetaMethodSite.StaticMetaMethodSiteNoUnwrapNoCoerce(site, metaClass, this, params);
}
|
public boolean equals(Object o) {
return (o instanceof CachedMethod && cachedMethod.equals(((CachedMethod)o).cachedMethod))
|| (o instanceof Method && cachedMethod.equals(o));
}
|
public static CachedMethod find(Method method) {
CachedMethod[] methods = ReflectionCache.getCachedClass(method.getDeclaringClass()).getMethods();
// for (int i = 0; i < methods.length; i++) {
// CachedMethod cachedMethod = methods[i];
// if (cachedMethod.cachedMethod.equals(method))
// return cachedMethod;
// }
// return null;
int i = Arrays.binarySearch(methods, method, comparator);
if (i < 0)
return null;
return methods[i];
}
|
public Method getCachedMethod() {
return cachedMethod;
}
|
public CachedClass getDeclaringClass() {
return cachedClass;
}
|
public String getDescriptor() {
return BytecodeHelper.getMethodDescriptor(getReturnType(), getNativeParameterTypes());
}
|
public int getModifiers() {
return cachedMethod.getModifiers();
}
|
public String getName() {
return cachedMethod.getName();
}
|
protected Class[] getPT() {
return cachedMethod.getParameterTypes();
}
|
public ParameterTypes getParamTypes() {
return null;
}
|
public int getParamsCount() {
return getParameterTypes().length;
}
|
public Class getReturnType() {
return cachedMethod.getReturnType();
}
|
public String getSignature() {
return getName() + getDescriptor();
}
|
public boolean hasPogoCallSiteConstructor() {
return pogoCallSiteConstructor != null && pogoCallSiteConstructor.get() != null;
}
|
public boolean hasPojoCallSiteConstructor() {
return pojoCallSiteConstructor != null && pojoCallSiteConstructor.get() != null;
}
|
public boolean hasStaticCallSiteConstructor() {
return staticCallSiteConstructor != null && staticCallSiteConstructor.get() != null;
}
|
public int hashCode() {
if (hashCode == 0) {
hashCode = cachedMethod.hashCode();
if (hashCode == 0)
hashCode = 0xcafebebe;
}
return hashCode;
}
|
public final Object invoke(Object object,
Object[] arguments) {
try {
return cachedMethod.invoke(object, arguments);
} catch (IllegalArgumentException e) {
throw new InvokerInvocationException(e);
} catch (IllegalAccessException e) {
throw new InvokerInvocationException(e);
} catch (InvocationTargetException e) {
throw new InvokerInvocationException(e);
}
}
|
public boolean isStatic() {
return MethodHelper.isStatic(cachedMethod);
}
|
public final Method setAccessible() {
// if (queuedToCompile.compareAndSet(false,true)) {
// if (isCompilable())
// CompileThread.addMethod(this);
// }
return cachedMethod;
}
|
public String toString() {
return cachedMethod.toString();
}
|