Package org.reflections.util

Examples of org.reflections.util.FilterBuilder


                        ClasspathHelper.forClassLoader(
                            ClasspathHelper.contextClassLoader(),
                            ClasspathHelper.staticClassLoader()
                        )
                    ).filterInputsBy(
                    new FilterBuilder().include(
                        FilterBuilder.prefix("com.jcabi.github")
                    )
                    )
            ).getSubTypesOf(Object.class),
            new Predicate<Class<?>>() {
View Full Code Here


     * @param packName
     * @return
     */
    private static Reflections getReflection(String packName) {

        Predicate<String> filter = new FilterBuilder().includePackage(
                Constants.DISCONF_PACK_NAME).includePackage(packName);

        //
        Reflections reflections = new Reflections(new ConfigurationBuilder()
                .filterInputsBy(filter)
View Full Code Here

  public AutoConfig(String... basePackages) {
    Preconditions.checkArgument(basePackages.length > 0);
   
    ConfigurationBuilder cfgBldr = new ConfigurationBuilder();
    FilterBuilder filterBuilder = new FilterBuilder();
    for (String basePkg : basePackages) {
      cfgBldr.addUrls(ClasspathHelper.forPackage(basePkg));
      filterBuilder.include(FilterBuilder.prefix(basePkg));
    }

    cfgBldr.filterInputsBy(filterBuilder).setScanners(
        new SubTypesScanner(), new TypeAnnotationsScanner());
    this.reflections = new Reflections(cfgBldr);
View Full Code Here

        configurationBuilder = new ConfigurationBuilder();
    }

    public FilterBuilder getFilterBuilder() {
        if (filterBuilder == null) {
            filterBuilder = new FilterBuilder();
        }
        return filterBuilder;
    }
View Full Code Here

            ReflectionUtils.withModifier(Modifier.STATIC), ReflectionUtils.withParametersCount(0));

    private final Reflections reflections;

    private ServiceLoaderImpl() {
        Predicate<String> filter = new FilterBuilder().include(FilterBuilder.prefix("configuration"));

        reflections = new Reflections(new ConfigurationBuilder().filterInputsBy(filter)
                .setUrls(ClasspathHelper.forPackage("configuration"))
                .setScanners(new TypeAnnotationsScanner(), new MethodAnnotationsScanner(), new TypesScanner()));
View Full Code Here

    /** created new SubTypesScanner.
     * @param excludeObjectClass if false, include direct {@link Object} subtypes in results.  */
    public SubTypesScanner(boolean excludeObjectClass) {
        if (excludeObjectClass) {
            filterResultsBy(new FilterBuilder().exclude(Object.class.getName())); //exclude direct Object subtypes
        }
    }
View Full Code Here

    /** collect saved Reflection xml resources and merge it into a Reflections instance
     * <p>by default, resources are collected from all urls that contains the package META-INF/reflections
     * and includes files matching the pattern .*-reflections.xml
     * */
    public static Reflections collect() {
        return collect("META-INF/reflections", new FilterBuilder().include(".*-reflections.xml"));
    }
View Full Code Here

    public static Class<? extends ITest>[] getClasses() {
        if (1 != 1) {
            return new Class[]{BooleanTest.class};
        }
        Reflections reflections = new Reflections(new ConfigurationBuilder()
                .filterInputsBy(new FilterBuilder().includePackage("be.pw999.jape.tests.impl"))
                .setUrls(ClasspathHelper.forPackage("be.pw999.jape.tests.impl"))
                .setScanners(new SubTypesScanner())
        );
        Set<Class<? extends ITest>> allClasses = reflections.getSubTypesOf(ITest.class);
        Set<Class<? extends ITest>> classes = new HashSet<Class<? extends ITest>>();
View Full Code Here

      List<ClassLoader> classLoadersList = new LinkedList<ClassLoader>();
      classLoadersList.add(ClasspathHelper.contextClassLoader());
      classLoadersList.add(ClasspathHelper.staticClassLoader());
     
      Reflections reflections = new Reflections(new ConfigurationBuilder().setScanners(new SubTypesScanner(false /* don't exclude Object.class */), new ResourcesScanner())
          .setUrls(ClasspathHelper.forClassLoader(classLoadersList.toArray(new ClassLoader[0]))).filterInputsBy(new FilterBuilder().include(FilterBuilder.prefix(name.substring(0, dot)))));
      Set<Class<?>> classes = reflections.getSubTypesOf(Object.class);
      for (Class<?> clazz : classes) {
        name = clazz.getName();
        dot = name.lastIndexOf('.');
        imports.put(name.substring(dot + 1), name);
View Full Code Here

     * @param packName
     * @return
     */
    private static Reflections getReflection(String packName) {

        Predicate<String> filter = new FilterBuilder().includePackage(
                Constants.DISCONF_PACK_NAME).includePackage(packName);

        //
        Reflections reflections = new Reflections(new ConfigurationBuilder()
                .filterInputsBy(filter)
View Full Code Here

TOP

Related Classes of org.reflections.util.FilterBuilder

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.