public TypeElementsScanner includeMethods() { return includeMethods(true); } public TypeElementsScanner includeMethods(boolean include) { includeMethods = include; return this; }
public TypeElementsScanner includeMethods() { return includeMethods(true); } public TypeElementsScanner includeMethods(boolean include) { includeMethods = include; return this; }
public TypeElementsScanner includeMethods() { return includeMethods(true); } public TypeElementsScanner includeMethods(boolean include) { includeMethods = include; return this; }
public TypeElementsScanner includeMethods() { return includeMethods(true); }
public TypeElementsScanner includeMethods() { return includeMethods(true); } public TypeElementsScanner includeMethods(boolean include) { includeMethods = include; return this; }
/** * Locate properties class for type class. * * @param type the type * @return the class */ public Class locatePropertiesClassForType(final ClassOrInterfaceType type) { if (cachedPropertiesClasses.containsKey(type.getNameAsString())) { return cachedPropertiesClasses.get(type.getNameAsString()); } val packageName = ConfigurationMetadataGenerator.class.getPackage().getName(); val reflections = new Reflections(new ConfigurationBuilder() .filterInputsBy(s -> s.contains(type.getNameAsString())) .setUrls(ClasspathHelper.forPackage(packageName)) .setScanners(new TypeElementsScanner() .includeFields(false) .includeMethods(false) .includeAnnotations(false) .filterResultsBy(s -> s.endsWith(type.getNameAsString())), new SubTypesScanner(false))); val clz = reflections.getSubTypesOf(Serializable.class).stream() .filter(c -> c.getSimpleName().equalsIgnoreCase(type.getNameAsString())) .findFirst() .orElseThrow(() -> new IllegalArgumentException("Cant locate class for " + type.getNameAsString())); cachedPropertiesClasses.put(type.getNameAsString(), clz); return clz; } }
/** * Add all the classes with a package prefix in the scope. * @param packageName the root package * @return the selector */ public Selector from(final String packageName) { Assertion.checkArgNotEmpty(packageName); checkScope(); // --- new Reflections(packageName, new TypeElementsScanner().includeAnnotations(false).includeFields(false).includeMethods(false)) .getStore() .get(TypeElementsScanner.class.getSimpleName()) .keys() .forEach(className -> from(ClassUtil.classForName(className))); return this; }