public static boolean inScope(final MethodScope methodScope, final Method method) { final boolean isStatic = JavaClassUtils.isStatic(method); return isStatic && methodScope == MethodScope.CLASS || !isStatic && methodScope == MethodScope.OBJECT; }
public static boolean inScope(final MethodScope methodScope, final Method method) { final boolean isStatic = JavaClassUtils.isStatic(method); return isStatic && methodScope == MethodScope.CLASS || !isStatic && methodScope == MethodScope.OBJECT; }
/** * From the supplied method array, finds but <i>does not remove</i> methods that have the required prefix, * and adds to the supplied candidates vector. */ public static void findPrefixedInstanceMethods(final Method[] methods, final String prefix, final List<Method> candidates) { for (int i = 0; i < methods.length; i++) { if (methods[i] == null) { continue; } final Method method = methods[i]; if (JavaClassUtils.isStatic(method)) { continue; } final boolean goodPrefix = method.getName().startsWith(prefix); final boolean goodCount = method.getParameterTypes().length == 0; if (goodPrefix && goodCount) { candidates.add(method); } } } }
/** * From the supplied method array, finds but <i>does not remove</i> methods that have the required prefix, * and adds to the supplied candidates vector. */ public static void findPrefixedInstanceMethods(final Method[] methods, final String prefix, final List<Method> candidates) { for (int i = 0; i < methods.length; i++) { if (methods[i] == null) { continue; } final Method method = methods[i]; if (JavaClassUtils.isStatic(method)) { continue; } final boolean goodPrefix = method.getName().startsWith(prefix); final boolean goodCount = method.getParameterTypes().length == 0; if (goodPrefix && goodCount) { candidates.add(method); } } } }
private String invokeSortOrderMethod(final String type) { final Method method = findAndRemoveMethod(MethodScope.CLASS, type + "Order", String.class, NO_PARAMETERS_TYPES); if (method == null) { return null; } else if (!JavaClassUtils.isStatic(method)) { LOG.warn("method " + className + "." + type + "Order() must be declared as static"); return null; } else { String s; s = (String) invokeMethod(method, NO_PARAMETERS); if (s.trim().length() == 0) { return null; } return s; } }
public OidStringifierDirect(Class<? extends Oid> oidClass) { Ensure.ensureThatArg(oidClass, is(not(nullValue(Class.class)))); this.oidClass = oidClass; try { deStringMethod = oidClass.getMethod("deString", String.class); } catch (SecurityException ex) { throw new IllegalArgumentException("Trying to obtain 'deString(String)' method from Oid class '" + oidClass.getName() + "'", ex); } catch (NoSuchMethodException ex) { throw new IllegalArgumentException("Trying to obtain 'deString(String)' method from Oid class '" + oidClass.getName() + "'", ex); } if(!JavaClassUtils.isStatic(deStringMethod)) { throw new IllegalArgumentException("'deString(String)' method for Oid class '" + oidClass.getName() + "' must be static"); } if(!JavaClassUtils.isPublic(deStringMethod)) { throw new IllegalArgumentException("'deString(String)' method for Oid class '" + oidClass.getName() + "' must be public"); } }
public OidStringifierDirect(Class<? extends Oid> oidClass) { Ensure.ensureThatArg(oidClass, is(not(nullValue(Class.class)))); this.oidClass = oidClass; try { deStringMethod = oidClass.getMethod("deString", String.class); } catch (SecurityException ex) { throw new IllegalArgumentException("Trying to obtain 'deString(String)' method from Oid class '" + oidClass.getName() + "'", ex); } catch (NoSuchMethodException ex) { throw new IllegalArgumentException("Trying to obtain 'deString(String)' method from Oid class '" + oidClass.getName() + "'", ex); } if(!JavaClassUtils.isStatic(deStringMethod)) { throw new IllegalArgumentException("'deString(String)' method for Oid class '" + oidClass.getName() + "' must be static"); } if(!JavaClassUtils.isPublic(deStringMethod)) { throw new IllegalArgumentException("'deString(String)' method for Oid class '" + oidClass.getName() + "' must be public"); } }
private String invokeSortOrderMethod(final String type) { final Method method = findAndRemoveMethod(MethodScope.CLASS, type + "Order", String.class, NO_PARAMETERS_TYPES); if (method == null) { return null; } else if (!JavaClassUtils.isStatic(method)) { LOG.warn("method " + className + "." + type + "Order() must be declared as static"); return null; } else { String s; s = (String) invokeMethod(method, NO_PARAMETERS); if (s.trim().length() == 0) { return null; } return s; } }