use of org.codehaus.groovy.reflection.CachedMethod in project groovy by apache.
the class SimpleExtensionModule method createMetaMethods.
private static void createMetaMethods(final Class extensionClass, final List<MetaMethod> metaMethods, final boolean isStatic) {
CachedClass cachedClass = ReflectionCache.getCachedClass(extensionClass);
CachedMethod[] methods = cachedClass.getMethods();
for (CachedMethod method : methods) {
if (method.isStatic() && method.isPublic() && method.getParamsCount() > 0) {
// an extension method is found
metaMethods.add(isStatic ? new NewStaticMetaMethod(method) : new NewInstanceMetaMethod(method));
}
}
}
use of org.codehaus.groovy.reflection.CachedMethod in project groovy by apache.
the class MetaClassImpl method addInterfaceMethods.
private void addInterfaceMethods(Set<CachedClass> interfaces) {
MetaMethodIndex.Header header = metaMethodIndex.getHeader(theClass);
for (CachedClass c : interfaces) {
final CachedMethod[] m = c.getMethods();
for (int i = 0; i != m.length; ++i) {
MetaMethod method = m[i];
addMetaMethodToIndex(method, header);
}
}
}
use of org.codehaus.groovy.reflection.CachedMethod in project groovy by apache.
the class A_GroovyReflector method doIt.
static void doIt() {
new A().protectedMethod();
try {
CachedMethod m = CachedMethod.find(A.class.getDeclaredMethod("protectedMethod", new Class[0]));
Object[] arguments = new Object[0];
m.setAccessible().invoke(new A(), arguments);
} catch (NoSuchMethodException e) {
} catch (IllegalAccessException e) {
} catch (InvocationTargetException e) {
}
}
Aggregations