private List<CtClass> applyFilter(JarArchiveComparatorOptions options, List<CtClass> ctClasses) { List<CtClass> newList = new ArrayList<>(ctClasses.size()); for (CtClass ctClass : ctClasses) { if (options.getFilters().includeClass(ctClass)) { newList.add(ctClass); } } return newList; }
private List<CtClass> applyFilter(JarArchiveComparatorOptions options, List<CtClass> ctClasses) { List<CtClass> newList = new ArrayList<>(ctClasses.size()); for (CtClass ctClass : ctClasses) { if (options.getFilters().includeClass(ctClass)) { newList.add(ctClass); } } return newList; }
private Map<String, CtField> buildFieldMap(CtClass ctClass) { Map<String, CtField> fieldMap = new HashMap<>(); CtField[] declaredFields = ctClass.getDeclaredFields(); for (CtField field : declaredFields) { if (options.getFilters().includeField(field)) { String name = field.getName(); fieldMap.put(name, field); } } return fieldMap; }
private Map<String, CtField> buildFieldMap(CtClass ctClass) { Map<String, CtField> fieldMap = new HashMap<>(); CtField[] declaredFields = ctClass.getDeclaredFields(); for (CtField field : declaredFields) { if (options.getFilters().includeField(field)) { String name = field.getName(); fieldMap.put(name, field); } } return fieldMap; }
private Map<String, List<CtMethod>> createMethodMap(Optional<CtClass> ctClassOptional) { Map<String, List<CtMethod>> methods = new HashMap<>(); if (ctClassOptional.isPresent()) { CtClass ctClass = ctClassOptional.get(); for (CtMethod ctMethod : ctClass.getDeclaredMethods()) { if (options.getFilters().includeBehavior(ctMethod)) { String name = ctMethod.getName(); List<CtMethod> ctMethods = methods.get(name); if (ctMethods == null) { ctMethods = new ArrayList<>(); methods.put(name, ctMethods); } ctMethods.add(ctMethod); } } } return methods; }
private Map<String, List<CtMethod>> createMethodMap(Optional<CtClass> ctClassOptional) { Map<String, List<CtMethod>> methods = new HashMap<>(); if (ctClassOptional.isPresent()) { CtClass ctClass = ctClassOptional.get(); for (CtMethod ctMethod : ctClass.getDeclaredMethods()) { if (options.getFilters().includeBehavior(ctMethod)) { String name = ctMethod.getName(); List<CtMethod> ctMethods = methods.get(name); if (ctMethods == null) { ctMethods = new ArrayList<>(); methods.put(name, ctMethods); } ctMethods.add(ctMethod); } } } return methods; }
private Map<String, CtConstructor> createConstructorMap(Optional<CtClass> ctClass) { Map<String, CtConstructor> methods = new HashMap<>(); if (ctClass.isPresent()) { for (CtConstructor ctConstructor : ctClass.get().getDeclaredConstructors()) { if (options.getFilters().includeBehavior(ctConstructor)) { methods.put(ctConstructor.getLongName(), ctConstructor); } } } return methods; }
private Map<String, CtConstructor> createConstructorMap(Optional<CtClass> ctClass) { Map<String, CtConstructor> methods = new HashMap<>(); if (ctClass.isPresent()) { for (CtConstructor ctConstructor : ctClass.get().getDeclaredConstructors()) { if (options.getFilters().includeBehavior(ctConstructor)) { methods.put(ctConstructor.getLongName(), ctConstructor); } } } return methods; }
options.getIgnoreMissingClasses().setIgnoreAllMissingClasses(ignoreMissingClasses); for (String packageInclude : packageIncludes) { options.getFilters().getIncludes().add(new JavadocLikePackageFilter(packageInclude)); options.getFilters().getExcludes().add(new JavadocLikePackageFilter(packageExclude)); options.getFilters().getIncludes().add(new JavaDocLikeClassFilter(classInclude)); options.getFilters().getExcludes().add(new JavaDocLikeClassFilter(classExclude)); options.getFilters().getIncludes().add(new JavadocLikeBehaviorFilter(methodInclude)); options.getFilters().getExcludes().add(new JavadocLikeBehaviorFilter(methodExclude)); options.getFilters().getIncludes().add(new JavadocLikeFieldFilter(fieldInclude)); options.getFilters().getExcludes().add(new JavadocLikeFieldFilter(fieldExclude)); options.getFilters().getIncludes().add(new AnnotationClassFilter(annotationInclude)); options.getFilters().getIncludes().add(new AnnotationFieldFilter(annotationInclude)); options.getFilters().getIncludes().add(new AnnotationBehaviorFilter(annotationInclude)); options.getFilters().getExcludes().add(new AnnotationClassFilter(annotationExclude)); options.getFilters().getExcludes().add(new AnnotationFieldFilter(annotationExclude)); options.getFilters().getExcludes().add(new AnnotationBehaviorFilter(annotationExclude));
private void updatePackageFilter(CtClass ctClass) { Filters filters = options.getFilters(); List<Filter> newFilters = new LinkedList<>(); for (Filter filter : filters.getIncludes()) { if (filter instanceof AnnotationFilterBase) { String className = ((AnnotationFilterBase) filter).getClassName(); if (AnnotationHelper.hasAnnotation(ctClass.getClassFile(), className)) { newFilters.add(new JavadocLikePackageFilter(ctClass.getPackageName(), false)); } } } if (newFilters.size() > 0) { filters.getIncludes().addAll(newFilters); newFilters.clear(); } for (Filter filter : filters.getExcludes()) { if (filter instanceof AnnotationFilterBase) { String className = ((AnnotationFilterBase) filter).getClassName(); if (AnnotationHelper.hasAnnotation(ctClass.getClassFile(), className)) { newFilters.add(new JavadocLikePackageFilter(ctClass.getPackageName(), false)); } } } if (newFilters.size() > 0) { filters.getExcludes().addAll(newFilters); newFilters.clear(); } }
private void updatePackageFilter(CtClass ctClass) { Filters filters = options.getFilters(); List<Filter> newFilters = new LinkedList<>(); for (Filter filter : filters.getIncludes()) { if (filter instanceof AnnotationFilterBase) { String className = ((AnnotationFilterBase) filter).getClassName(); if (AnnotationHelper.hasAnnotation(ctClass.getClassFile(), className)) { newFilters.add(new JavadocLikePackageFilter(ctClass.getPackageName(), false)); } } } if (newFilters.size() > 0) { filters.getIncludes().addAll(newFilters); newFilters.clear(); } for (Filter filter : filters.getExcludes()) { if (filter instanceof AnnotationFilterBase) { String className = ((AnnotationFilterBase) filter).getClassName(); if (AnnotationHelper.hasAnnotation(ctClass.getClassFile(), className)) { newFilters.add(new JavadocLikePackageFilter(ctClass.getPackageName(), false)); } } } if (newFilters.size() > 0) { filters.getExcludes().addAll(newFilters); newFilters.clear(); } }
public static JarArchiveComparatorOptions of(Options options) { JarArchiveComparatorOptions comparatorOptions = new JarArchiveComparatorOptions(); comparatorOptions.getFilters().getExcludes().addAll(options.getExcludes()); comparatorOptions.getFilters().getIncludes().addAll(options.getIncludes()); comparatorOptions.setAccessModifier(options.getAccessModifier()); comparatorOptions.setIncludeSynthetic(options.isIncludeSynthetic()); comparatorOptions.setIgnoreMissingClasses(options.getIgnoreMissingClasses()); toJarArchiveComparatorClassPathMode(options, comparatorOptions); toJarArchiveComparatorClassPath(options.getOldClassPath(), comparatorOptions.getOldClassPath()); toJarArchiveComparatorClassPath(options.getNewClassPath(), comparatorOptions.getNewClassPath()); comparatorOptions.setNoAnnotations(options.isNoAnnotations()); return comparatorOptions; }
public static JarArchiveComparatorOptions of(Options options) { JarArchiveComparatorOptions comparatorOptions = new JarArchiveComparatorOptions(); comparatorOptions.getFilters().getExcludes().addAll(options.getExcludes()); comparatorOptions.getFilters().getIncludes().addAll(options.getIncludes()); comparatorOptions.setAccessModifier(options.getAccessModifier()); comparatorOptions.setIncludeSynthetic(options.isIncludeSynthetic()); comparatorOptions.setIgnoreMissingClasses(options.getIgnoreMissingClasses()); toJarArchiveComparatorClassPathMode(options, comparatorOptions); toJarArchiveComparatorClassPath(options.getOldClassPath(), comparatorOptions.getOldClassPath()); toJarArchiveComparatorClassPath(options.getNewClassPath(), comparatorOptions.getNewClassPath()); comparatorOptions.setNoAnnotations(options.isNoAnnotations()); return comparatorOptions; }