CachedMethod cachedGetter = CachedMethod.find(method); getter = cachedGetter == null ? null : findMethod(cachedGetter); } else { method = pd.getWriteMethod(); if (method != null) { CachedMethod cachedSetter = CachedMethod.find(method); setter = cachedSetter == null ? null : findMethod(cachedSetter); } else {
protected NewInstanceMetaMethod createNewMetaMethod(Method method) { return new NewInstanceMetaMethod(CachedMethod.find(method)); } }
Method[] listenerMethods = descriptor.getListenerMethods(); for (Method listenerMethod : listenerMethods) { final MetaMethod metaMethod = CachedMethod.find(descriptor.getAddListenerMethod());
/** *Adds a static method to this metaclass. * * @param method The method to be added */ public void addNewStaticMethod(Method method) { final CachedMethod cachedMethod = CachedMethod.find(method); NewStaticMetaMethod newMethod = new NewStaticMetaMethod(cachedMethod); final CachedClass declaringClass = newMethod.getDeclaringClass(); addNewStaticMethodToIndex(newMethod, metaMethodIndex.getHeader(declaringClass.getTheClass())); }
/** *Adds an instance method to this metaclass. * * @param method The method to be added */ public void addNewInstanceMethod(Method method) { final CachedMethod cachedMethod = CachedMethod.find(method); NewInstanceMetaMethod newMethod = new NewInstanceMetaMethod(cachedMethod); final CachedClass declaringClass = newMethod.getDeclaringClass(); addNewInstanceMethodToIndex(newMethod, metaMethodIndex.getHeader(declaringClass.getTheClass())); }
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) { } } }
public static ParameterTypes getParameterTypes(Object methodOrConstructor) { if (methodOrConstructor instanceof ParameterTypes) { return (ParameterTypes) methodOrConstructor; } if (methodOrConstructor instanceof Method) { Method method = (Method) methodOrConstructor; return CachedMethod.find(method); } if (methodOrConstructor instanceof Constructor) { Constructor constructor = (Constructor) methodOrConstructor; return CachedConstructor.find(constructor); } throw new IllegalArgumentException("Must be a Method or Constructor"); }
private void applyPropertyDescriptors(PropertyDescriptor[] propertyDescriptors) { // now iterate over the map of property descriptors and generate // MetaBeanProperty objects for (int i = 0; i < propertyDescriptors.length; i++) { PropertyDescriptor pd = propertyDescriptors[i]; // skip if the property type is unknown (this seems to be the case if the // property descriptor is based on a setX() method that has two parameters, // which is not a valid property) if (pd.getPropertyType() == null) continue; // get the getter method Method method = pd.getReadMethod(); MetaMethod getter; if (method != null) getter = findMethod(CachedMethod.find(method)); else getter = null; // get the setter method MetaMethod setter; method = pd.getWriteMethod(); if (method != null) setter = findMethod(CachedMethod.find(method)); else setter = null; // now create the MetaProperty object MetaBeanProperty mp = new MetaBeanProperty(pd.getName(), pd.getPropertyType(), getter, setter); addMetaBeanProperty(mp); } }
CachedMethod cachedGetter = CachedMethod.find(method); getter = cachedGetter == null ? null : findMethod(cachedGetter); } else { method = pd.getWriteMethod(); if (method != null) { CachedMethod cachedSetter = CachedMethod.find(method); setter = cachedSetter == null ? null : findMethod(cachedSetter); } else {
CachedMethod cachedGetter = CachedMethod.find(method); getter = cachedGetter == null ? null : findMethod(cachedGetter); } else { method = pd.getWriteMethod(); if (method != null) { CachedMethod cachedSetter = CachedMethod.find(method); setter = cachedSetter == null ? null : findMethod(cachedSetter); } else {
CachedMethod cachedGetter = CachedMethod.find(method); getter = cachedGetter == null ? null : findMethod(cachedGetter); } else { method = pd.getWriteMethod(); if (method != null) { CachedMethod cachedSetter = CachedMethod.find(method); setter = cachedSetter == null ? null : findMethod(cachedSetter); } else {
/** * Delegated to from the global use(CategoryClass) method. It scans the Category class for static methods * that take 1 or more parameters. The first parameter is the class you are adding the category method to, * additional parameters are those parameters needed by that method. A use statement cannot be undone and * is valid only for the current thread. * * @param categoryClass the class containing category methods */ private static void use(Class categoryClass) { Map properties = getProperties(); List stack = (List) LOCAL.get(); LinkedList clonedLists = new LinkedList(); Method[] methods = categoryClass.getMethods(); for (int i = 0; i < methods.length; i++) { Method method = methods[i]; if (Modifier.isStatic(method.getModifiers())) { final CachedMethod cachedMethod = CachedMethod.find(method); CachedClass[] paramTypes = cachedMethod.getParameterTypes(); if (paramTypes.length > 0) { CachedClass metaClass = paramTypes[0]; Map metaMethodsMap = getMetaMethods(properties, metaClass.getTheClass()); List methodList = getMethodList(metaMethodsMap, method.getName()); MetaMethod mmethod = new CategoryMethod(cachedMethod, metaClass.getTheClass()); methodList.add(mmethod); Collections.sort(methodList); } } } }
public void addNewStaticMethod(Method method) { final CachedMethod cachedMethod = CachedMethod.find(method); NewStaticMetaMethod newMethod = new NewStaticMetaMethod(cachedMethod); final CachedClass declaringClass = newMethod.getDeclaringClass(); addNewStaticMethodToIndex(newMethod, metaMethodIndex.getHeader(declaringClass.getTheClass())); }
public void addNewStaticMethod(Method method) { final CachedMethod cachedMethod = CachedMethod.find(method); NewStaticMetaMethod newMethod = new NewStaticMetaMethod(cachedMethod); final CachedClass declaringClass = newMethod.getDeclaringClass(); addNewStaticMethodToIndex(newMethod, metaMethodIndex.getHeader(declaringClass.getTheClass())); }
public void addNewInstanceMethod(Method method) { final CachedMethod cachedMethod = CachedMethod.find(method); NewInstanceMetaMethod newMethod = new NewInstanceMetaMethod(cachedMethod); final CachedClass declaringClass = newMethod.getDeclaringClass(); addNewInstanceMethodToIndex(newMethod, metaMethodIndex.getHeader(declaringClass.getTheClass())); }
public void addNewStaticMethod(Method method) { final CachedMethod cachedMethod = CachedMethod.find(method); NewStaticMetaMethod newMethod = new NewStaticMetaMethod(cachedMethod); final CachedClass declaringClass = newMethod.getDeclaringClass(); addNewStaticMethodToIndex(newMethod, metaMethodIndex.getHeader(declaringClass.getTheClass())); }
public void addNewInstanceMethod(Method method) { final CachedMethod cachedMethod = CachedMethod.find(method); NewInstanceMetaMethod newMethod = new NewInstanceMetaMethod(cachedMethod); final CachedClass declaringClass = newMethod.getDeclaringClass(); addNewInstanceMethodToIndex(newMethod, metaMethodIndex.getHeader(declaringClass.getTheClass())); }
public void addNewStaticMethod(Method method) { final CachedMethod cachedMethod = CachedMethod.find(method); NewStaticMetaMethod newMethod = new NewStaticMetaMethod(cachedMethod); final CachedClass declaringClass = newMethod.getDeclaringClass(); addNewStaticMethodToIndex(newMethod, metaMethodIndex.getHeader(declaringClass.getTheClass())); }
public void addNewInstanceMethod(Method method) { final CachedMethod cachedMethod = CachedMethod.find(method); NewInstanceMetaMethod newMethod = new NewInstanceMetaMethod(cachedMethod); final CachedClass declaringClass = newMethod.getDeclaringClass(); addNewInstanceMethodToIndex(newMethod, metaMethodIndex.getHeader(declaringClass.getTheClass())); }
public void addNewInstanceMethod(Method method) { final CachedMethod cachedMethod = CachedMethod.find(method); NewInstanceMetaMethod newMethod = new NewInstanceMetaMethod(cachedMethod); final CachedClass declaringClass = newMethod.getDeclaringClass(); addNewInstanceMethodToIndex(newMethod, metaMethodIndex.getHeader(declaringClass.getTheClass())); }