Examples of Reflections


Examples of org.givwenzen.reflections.Reflections

*/
public class CustomParserFinder implements ICustomParserFinder {

    @Override
    public void addCustomParsers(List<MethodParameterParser> accumulatedParsers) {
        Reflections reflections = new ReflectionsBuilder()
                .basePackage("bdd.parse.")
                .subTypeScanner()
                .build();
        Set<Class<? extends MethodParameterParser>> classes = reflections.getSubTypesOf(MethodParameterParser.class);
        for (Class<? extends MethodParameterParser> aClass : classes) {
            try {
                accumulatedParsers.add(aClass.newInstance());
            } catch (InstantiationException e) {
                throw new GivWenZenException(

Examples of org.jboss.errai.reflections.Reflections

* </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) {
      throw new RuntimeException(e);
    }
    for (Object e1 : document.getRootElement().elements()) {
      Element index = (Element) e1;
      for (Object e2 : index.elements()) {
        Element entry = (Element) e2;
        Element key = entry.element("key");
        Element values = entry.element("values");
        for (Object o3 : values.elements()) {
          Element value = (Element) o3;
          Multimap<String, String> stringStringMultimap = reflections.getStore().getStoreMap().get(index.getName());
          if (stringStringMultimap == null) {
            reflections.getStore().getStoreMap().put(index.getName(),
                stringStringMultimap = HashMultimap.<String, String>create());
          }

          stringStringMultimap.put(key.getText(), value.getText());
        }

Examples of org.reflections.Reflections

            return headers;
        }

        @Override
        public Enumeration findEntries(String path, String filePattern, boolean recurse) {
            Reflections reflections = new Reflections(this.packageName);
            Set<Class<?>> types = reflections.getTypesAnnotatedWith(Model.class);
            Vector<URL> urls = new Vector<URL>(); // NOPMD
            try {
                for (Class<?> type : types) {
                    urls.add(new URL("file:/" + type.getName().replace('.', '/') + ".class"));
                }

Examples of org.reflections.Reflections

    this.notMatchingRegex = notMatchingRegex;
    return this;
  }

  private Set<Class<?>> scanTypes(String packageName) {
    Reflections reflections = new Reflections(packageName,
        new MethodAnnotationsScanner());
    Set<Class<?>> types = new HashSet<Class<?>>();
    types.addAll(typesAnnotatedWith(reflections, Given.class));
    types.addAll(typesAnnotatedWith(reflections, When.class));
    types.addAll(typesAnnotatedWith(reflections, Then.class));

Examples of org.reflections.Reflections

        return null;
    }


    public List<RouteClass> buildClasses() {
        Reflections ref = new Reflections(sourcePackage);
        Set<Class<?>> classes = ref.getTypesAnnotatedWith(Path.class);

        List<RouteClass> routeClassList = Lists.newArrayList();

        for (Class<?> klazz : classes) {
            RouteClass routeClass = buildRouteClass(klazz);

Examples of org.reflections.Reflections

    public Generator(String packageName, ObjectMapper mapper) {
        this.mapper = mapper;

        synchronized (lock) {
            if (reflections == null) {
                reflections = new Reflections(packageName);
            }
        }
    }

Examples of org.reflections.Reflections

      URL url = urlIter.next();
      if(url.toString().toLowerCase().endsWith(".jar") || !url.toString().toLowerCase().contains(".")) {
        urls.add(url);
      }
    }
    Reflections ref = new Reflections(new ConfigurationBuilder().setUrls(urls));
    for(Class<?> clazz: ref.getTypesAnnotatedWith(URIHandler.class)) {
      if(PipelineModifier.class.isAssignableFrom(clazz)) {
        URIHandler uhandler = clazz.getAnnotation(URIHandler.class);
        try {
          PipelineModifier pm = (PipelineModifier)clazz.newInstance();
          String[] names = uhandler.uri();

Examples of org.reflections.Reflections

*/
public class PeriodicalBindings extends AbstractModule {
    @Override
    protected void configure() {
        Multibinder<Periodical> periodicalBinder = Multibinder.newSetBinder(binder(), Periodical.class);
        Reflections reflections = new Reflections("org.graylog2.periodical");
        for (Class<? extends Periodical> periodicalClass : reflections.getSubTypesOf(Periodical.class))
            if (!Modifier.isAbstract(periodicalClass.getModifiers()))
                periodicalBinder.addBinding().to(periodicalClass);
    }

Examples of org.reflections.Reflections

    private static final Logger LOG = LoggerFactory.getLogger(NodeRunner.class);

    protected static List<Module> getBindingsModules(InstantiationService instantiationService, Module... specificModules) {
        List<Module> result = Lists.newArrayList();
        result.add(new GenericBindings(instantiationService));
        Reflections reflections = new Reflections("org.graylog2.shared.bindings");
        final Set<Class<? extends AbstractModule>> generic = reflections.getSubTypesOf(AbstractModule.class);
        final Set<Class<? extends Graylog2Module>> gl2Modules = reflections.getSubTypesOf(Graylog2Module.class);
        for (Class<? extends Module> type : Iterables.concat(generic, gl2Modules)) {
            // skip the GenericBindings module, because we have already instantiated it above, avoids a bogus log message
            if (type.equals(GenericBindings.class)) {
                continue;
            }

Examples of org.reflections.Reflections

    }

    @Override
    public void initialize(Map<String, String> config) throws InitializerConfigurationException {
        String packageName = Periodical.class.getPackage().toString();
        Reflections reflections = new Reflections("org.graylog2.shared.periodical");

        for (Class<? extends Periodical> type : reflections.getSubTypesOf(Periodical.class)) {
            try {
                Periodical periodical = instantiationService.getInstance(type);

                periodical.initialize();
TOP
Copyright © 2018 www.massapi.com. 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.