private List<Method> findCandidateWriteMethods(MethodDescriptor[] methodDescriptors) { List<Method> matches = new ArrayList<>(); for (MethodDescriptor methodDescriptor : methodDescriptors) { Method method = methodDescriptor.getMethod(); if (isCandidateWriteMethod(method)) { matches.add(method); } } // Sort non-void returning write methods to guard against the ill effects of // non-deterministic sorting of methods returned from Class#getDeclaredMethods // under JDK 7. See http://bugs.sun.com/view_bug.do?bug_id=7023180 matches.sort((m1, m2) -> m2.toString().compareTo(m1.toString())); return matches; }
private List<Method> findCandidateWriteMethods(MethodDescriptor[] methodDescriptors) { List<Method> matches = new ArrayList<>(); for (MethodDescriptor methodDescriptor : methodDescriptors) { Method method = methodDescriptor.getMethod(); if (isCandidateWriteMethod(method)) { matches.add(method); } } // Sort non-void returning write methods to guard against the ill effects of // non-deterministic sorting of methods returned from Class#getDeclaredMethods // under JDK 7. See http://bugs.sun.com/view_bug.do?bug_id=7023180 matches.sort((m1, m2) -> m2.toString().compareTo(m1.toString())); return matches; }
private static Method findMethod(Class<?> targetType, String methodName, Class<?>[] argTypes) throws IntrospectionException { BeanInfo beanInfo = Introspector.getBeanInfo(targetType); if (beanInfo != null) { for(MethodDescriptor methodDesc: beanInfo.getMethodDescriptors()) { Method method = methodDesc.getMethod(); Class<?>[] parameterTypes = method.getParameterTypes(); if (methodName.equals(method.getName()) && argTypes.length == parameterTypes.length) { boolean matchedArgTypes = true; for (int i = 0; i < argTypes.length; i++) { if (getWrapperIfPrimitive(argTypes[i]) != parameterTypes[i]) { matchedArgTypes = false; break; } } if (matchedArgTypes) { return method; } } } } return null; }
= new ArrayList<MethodDescriptor>(introspectionMDs.size() + 16); for (MethodDescriptor introspectorMD : introspectionMDs) { Method introspectorM = introspectorMD.getMethod();
IdentityHashMap<Method, Void> argTypesUsedByIndexerPropReaders = null; for (int i = mdsSize - 1; i >= 0; --i) { final Method method = getMatchingAccessibleMethod(mds.get(i).getMethod(), accessibleMethods); if (method != null && isAllowedToExpose(method)) { decision.setDefaults(method);
protected Method getMethod(String methodName) { if (methodDescriptors == null) { introspect(); } for (int i = 0; i < methodDescriptors.length; i++) { if (methodName.equals(methodDescriptors[i].getName())) { return methodDescriptors[i].getMethod(); } } return null; }
for (MethodDescriptor methodDescriptor : methodDescriptors) { methodMap.put( methodDescriptor.getName().toLowerCase(Locale.ENGLISH), methodDescriptor.getMethod());
for (MethodDescriptor methodDescriptor : methodDescriptors) { chartMethodMap.put( methodDescriptor.getName().toLowerCase(Locale.ENGLISH), methodDescriptor.getMethod()); for (MethodDescriptor methodDescriptor : methodDescriptors) { stylerMethodMap.put( methodDescriptor.getName().toLowerCase(Locale.ENGLISH), methodDescriptor.getMethod());
Method method = md.getMethod();
private Integer getId(final X anotherParameter) { final BeanInfo beanInfo = Introspector.getBeanInfo(anotherParameter.getClass()); for (MethodDescriptor methodDescriptor : beanInfo.getMethodDescriptors()) { final Method method = methodDescriptor.getMethod(); if ("getId".equals(method.getName()) && method.getParameterTypes().length == 0) { return (Integer) method.invoke(anotherParameter); } } return null; }
/** * Returns the Method */ public Method getMethod() { return getMethodDescriptor().getMethod(); }
/** * Returns true if the specified method accepts a * <code>Substitution</code> as its last parameter. */ public boolean acceptsSubstitution(MethodDescriptor md) { return acceptsSubstitution(md.getMethod()); }
/** * Add an event method with a given name and event type, and return type * * @param md * @param name * @return */ public boolean hasEventMethod(MethodDescriptor md, String name) { Class[] pts = md.getMethod().getParameterTypes(); return javaClass.getMethod(name, pts) != null; }
protected Method getMethod(String methodName) { if (methodDescriptors == null) { introspect(); } for (int i = 0; i < methodDescriptors.length; i++) { if (methodName.equals(methodDescriptors[i].getName())) { return methodDescriptors[i].getMethod(); } } return null; }
protected Method getMethod(String methodName) { if (methodDescriptors == null) { introspect(); } for (int i = 0; i < methodDescriptors.length; i++) { if (methodName.equals(methodDescriptors[i].getName())) { return methodDescriptors[i].getMethod(); } } return null; }
protected Method getMethod(String methodName) { if (methodDescriptors == null) { introspect(); } for (int i = 0; i < methodDescriptors.length; i++) { if (methodName.equals(methodDescriptors[i].getName())) { return methodDescriptors[i].getMethod(); } } return null; }
/** * Find an (event) method with a given name * * @param name * @return */ public Method getEventMethod(String name, MethodDescriptor md) { Class[] pts = md.getMethod().getParameterTypes(); assert Trace.trace("insync.beans", "BU.getEventMethod name:" + name + " null"); //NOI18N return javaClass.getMethod(name, pts); }
protected Method getMethod(String methodName) { if (methodDescriptors == null) { introspect(); } for (int i = 0; i < methodDescriptors.length; i++) { if (methodName.equals(methodDescriptors[i].getName())) { return methodDescriptors[i].getMethod(); } } return null; }
private void stubBody(Method method) { Class retType = getMethodDescriptor(method.getName()).getMethod().getReturnType(); String body = null; if (retType != Void.TYPE) { body = "return null;"; } method.replaceBody(body); }
void loadList() { assert Trace.trace("insync.live", "EPE.loadList"); BeansDesignBean bean = (BeansDesignBean)event.getDesignBean(); LiveUnit unit = bean.unit; EventDescriptor ed = event.getEventDescriptor(); java.lang.reflect.Method m = ed.getListenerMethodDescriptor().getMethod(); methods = unit.sourceUnit.getThisClass().getMethodNames( m.getParameterTypes(), m.getReturnType()).toArray(new String[0]); }