Package org.jboss.errai.reflections.util

Examples of org.jboss.errai.reflections.util.ConfigurationBuilder


  static final Map<String, Set<SortableClassFileWrapper>> annotationsToClassFile =
      new ConcurrentHashMap<String, Set<SortableClassFileWrapper>>();

  private static Configuration getConfiguration(final List<URL> urls) {
    return new ConfigurationBuilder()
        .setUrls(urls)
        .setExecutorService(Executors.newFixedThreadPool(2))
        .setScanners(
            new FieldAnnotationsScanner(),
            new MethodAnnotationsScanner(),
View Full Code Here


     * <br> - acceptsInput where name starts with the given {@code prefix}
     * <br> - scanners set to the given {@code scanners}, otherwise defaults to {@link TypeAnnotationsScanner} and {@link SubTypesScanner}.
     * <br> - scanner results filter is set to accept results matching given {@code prefix}
     */
    public Reflections(final String prefix, final Scanner... scanners) {
        this(new ConfigurationBuilder() {
            {
                final Predicate<String> filter = new FilterBuilder.Include(FilterBuilder.prefix(prefix));

                setUrls(ClasspathHelper.forPackage(prefix));
                filterInputsBy(filter);
View Full Code Here

     * <br> - scanners set to the given {@code scanners}, otherwise defaults to {@link TypeAnnotationsScanner} and {@link SubTypesScanner}.
     * <br> - scanner results filter is set to accept results matching given {@code prefix} or the given classes package name
     * @param urlHints is an array of either String or Class elements, where Strings results in scanning package prefix and Class results in scanning urls containing the class
     */
    public Reflections(final Object[] urlHints, final Scanner... scanners) {
        this(new ConfigurationBuilder() {
            {
                final List<String> prefixes = Lists.newArrayList();

                for (Object urlHint : urlHints) {
                    if (urlHint instanceof String) {
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 new Reflections(new ConfigurationBuilder()).
            collect("META-INF/reflections", new FilterBuilder().include(".*-reflections.xml"));
    }
View Full Code Here

* </pre>
* */
public class XmlSerializer implements Serializer {

    public Reflections read(InputStream inputStream) {
        Reflections reflections = new Reflections(new ConfigurationBuilder()) {};

        Document document;
        try {
            document = new SAXReader().read(inputStream);
        } catch (DocumentException e) {
View Full Code Here

      }

      // Now get all files in the message bundle (all localized versions)
      // TODO optimize this - scan the classpath once and then pull out just the resources we need
      MessageBundleScanner scanner = new MessageBundleScanner(
              new ConfigurationBuilder()
              .filterInputsBy(new FilterBuilder().include(".*json"))
              .setUrls(ClasspathHelper.forClassLoader())
              .setScanners(new MessageBundleResourceScanner(bundlePath)));
      Collection<String> resources = scanner.getStore().get(MessageBundleResourceScanner.class).values();
      // If we didn't find at least the specified root bundle file, that's a problem.
View Full Code Here

class GwtValidatorGenerator {

  class ValidationScanner extends Reflections {

    ValidationScanner() {
      super(new ConfigurationBuilder().setUrls(ClasspathHelper.forClassLoader())
      // Override default scanners
              .setScanners(
                      new FilterTypeAnnotationsScanner(new SimplePackageFilter(PropertiesUtil.getPropertyValues(
                              BLACKLIST_PROPERTY, "\\s"))),
                      new FilterFieldAnnotationsScanner(new SimplePackageFilter(PropertiesUtil.getPropertyValues(
View Full Code Here

            return;
        }

        //

        ConfigurationBuilder configurationBuilder = new ConfigurationBuilder()
                .setUrls(Arrays.asList(parseOutputDirUrl()))
                .setScanners(new SubTypesScanner(), new TypeAnnotationsScanner());

        FilterBuilder filter = FilterBuilder.parse(includeExclude);

        configurationBuilder.filterInputsBy(filter);

        Serializer serializerInstance = null;
        if (serializer != null && serializer.length() != 0) {
            try {
                serializerInstance = (Serializer) Class.forName(serializer).newInstance();
                configurationBuilder.setSerializer(serializerInstance);
            } catch (Exception ex) {
                throw new ReflectionsException("could not create serializer instance", ex);
            }
        }

        final Set<Scanner> scannerInstances;
        if (scanners != null && scanners.length() != 0) {
            scannerInstances = parseScanners(filter);
        } else {
            scannerInstances = Sets.<Scanner>newHashSet(new SubTypesScanner(), new TypeAnnotationsScanner());
        }

        if (serializerInstance != null) {
            scannerInstances.add(new TypesScanner());
            scannerInstances.add(new TypeElementsScanner());
            getLog().info("added type scanners");
        }

        configurationBuilder.setScanners(scannerInstances.toArray(new Scanner[]{}));

        if (parallel != null && parallel.equals(Boolean.TRUE)) {
            configurationBuilder.useParallelExecutor();
        }

        Reflections reflections = new Reflections(configurationBuilder);

        for (String destination : parseDestinations()) {
View Full Code Here

    // Now get all files in the message bundle (all localized versions)
    final Collection<URL> scannableUrls = getScannableUrls(bundleAnnotatedClasses);
    log.info("Preparing to scan for i18n bundle files.");
    MessageBundleScanner scanner = new MessageBundleScanner(
            new ConfigurationBuilder()
                .filterInputsBy(new FilterBuilder().include(".*json"))
                .setUrls(scannableUrls)
                .setScanners(new MessageBundleResourceScanner(bundlePaths)));

    // For each one, generate the code to load the translation and put that generated
View Full Code Here

    return reflections.getStore().get(LessResourceScanner.class).values();
  }

  private static class LessReflections extends Reflections {
    private LessReflections() {
      super(new ConfigurationBuilder()
              .filterInputsBy(new FilterBuilder().include(".*\\.less"))
              .setScanners(new LessResourceScanner())
              .setUrls(MetaDataScanner.getConfigUrls()));
      scan();
    }
View Full Code Here

TOP

Related Classes of org.jboss.errai.reflections.util.ConfigurationBuilder

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.