private Class<?> loadBuiltIn(final String className) throws ClassNotFoundException { Class<?> builtIn = JavaClassUtils.getBuiltIn(className); if (builtIn != null) { return builtIn; } return Class.forName(className); }
public String[] getInterfaces() { return JavaClassUtils.getInterfaces(type); }
public String getSuperclass() { return JavaClassUtils.getSuperclass(type); }
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 static boolean inScope(final MethodScope methodScope, final Method method) { final boolean isStatic = JavaClassUtils.isStatic(method); return isStatic && methodScope == MethodScope.CLASS || !isStatic && methodScope == MethodScope.OBJECT; }
private void removeSuperclassMethods(final Class<?> type, final MethodRemover methodRemover) { if (type == null) { return; } if (!JavaClassUtils.isJavaClass(type)) { removeSuperclassMethods(type.getSuperclass(), methodRemover); return; } final Method[] methods = type.getMethods(); for (int j = 0; j < methods.length; j++) { final Method method = methods[j]; methodRemover.removeMethod(method); } }
public boolean isAbstract() { return JavaClassUtils.isAbstract(type); }
public boolean isFinal() { return JavaClassUtils.isFinal(type); }
/** * Wires components as necessary, and then {@link ApplicationScopedComponent#init() init}ializes all. */ public void init() { templateImageLoader.init(); specificationLoader.setServiceClasses(JavaClassUtils.toClasses(serviceList)); specificationLoader.init(); // must come after init of spec loader. specificationLoader.injectInto(persistenceSessionFactory); persistenceSessionFactory.setServices(serviceList); userProfileLoader.setServices(serviceList); authenticationManager.init(); authorizationManager.init(); persistenceSessionFactory.init(); }
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 static boolean inScope(final MethodScope methodScope, final Method method) { final boolean isStatic = JavaClassUtils.isStatic(method); return isStatic && methodScope == MethodScope.CLASS || !isStatic && methodScope == MethodScope.OBJECT; }
private void removeSuperclassMethods(final Class<?> type, final MethodRemover methodRemover) { if (type == null) { return; } if (!JavaClassUtils.isJavaClass(type)) { removeSuperclassMethods(type.getSuperclass(), methodRemover); return; } final Method[] methods = type.getMethods(); for (int j = 0; j < methods.length; j++) { final Method method = methods[j]; methodRemover.removeMethod(method); } }
public boolean isAbstract() { return JavaClassUtils.isAbstract(type); }
public boolean isFinal() { return JavaClassUtils.isFinal(type); }
/** * 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); } } } }
/** * If no title or toString can be used then will use Facets provided by {@link FallbackFacetFactory} * instead. */ @Override public boolean process(final Class<?> type, final MethodRemover methodRemover, final FacetHolder facetHolder) { Method method = findMethod(type, OBJECT, TITLE, String.class, null); if (method != null) { methodRemover.removeMethod(method); return FacetUtil.addFacet(new TitleFacetViaTitleMethod(method, facetHolder)); } try { method = findMethod(type, OBJECT, TO_STRING, String.class, null); if (method == null) { return false; } if (JavaClassUtils.isJavaClass(method.getDeclaringClass())) { return false; } methodRemover.removeMethod(method); FacetUtil.addFacet(new TitleFacetViaToStringMethod(method, facetHolder)); return false; } catch (final Exception e) { return false; } } }
private Class<?> loadBuiltIn(final String className) throws ClassNotFoundException { Class<?> builtIn = JavaClassUtils.getBuiltIn(className); if (builtIn != null) { return builtIn; } return Class.forName(className); }
public String[] getInterfaces() { return JavaClassUtils.getInterfaces(type); }
public String getSuperclass() { return JavaClassUtils.getSuperclass(type); }
/** * 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); } } } }