Package org.fudgemsg

Examples of org.fudgemsg.AnnotationReflector


   * @return the matching elements, not null
   */
  public static Set<String> scan(URL[] classpathUrls, String annotationClassName) {
    ArgumentChecker.notNull(annotationClassName, "annotationClassName");
    Set<URL> urls = new HashSet<>(Arrays.asList(classpathUrls));
    AnnotationReflector reflector = new AnnotationReflector(
        null, urls, new TypeAnnotationsScanner(),
        ClassNameAnnotationScannerUtils.class.getClassLoader(), Thread.currentThread().getContextClassLoader());
    Set<String> classNames = reflector.getReflector().getStore().getTypesAnnotatedWith(annotationClassName);
    if (classNames == null) {
      return Collections.emptySet();
    }
    return Collections.unmodifiableSet(classNames);
  }
View Full Code Here


    if (isScanParameterAnnotations()) {
      config[scanners++] = new MethodParameterScanner();
    }
    config[scanners++] = ClasspathScanner.class.getClassLoader();
    config[scanners++] = Thread.currentThread().getContextClassLoader();
    AnnotationReflector reflector = new AnnotationReflector(null, _urls, config);
    final HashSet<String> classNames = new HashSet<String>();
    if (isScanClassAnnotations()) {
      classNames.addAll(reflector.getReflector().getStore().getTypesAnnotatedWith(annotationClass.getName()));
    }
    if (isScanFieldAnnotations()) {
      Set<Field> fields = reflector.getReflector().getFieldsAnnotatedWith(annotationClass);
      for (Field field : fields) {
        classNames.add(field.getDeclaringClass().getName());
      }
    }
    if (isScanMethodAnnotations()) {
      Set<Method> methods = reflector.getReflector().getMethodsAnnotatedWith(annotationClass);
      for (Method method : methods) {
        classNames.add(method.getDeclaringClass().getName());
      }
      Set<Constructor> constructors = reflector.getReflector().getConstructorsAnnotatedWith(annotationClass);
      for (Constructor constructor : constructors) {
        classNames.add(constructor.getDeclaringClass().getName());
      }
    }
    if (isScanParameterAnnotations()) {
      Set<Method> paramMethods = reflector.getReflector().getMethodsWithAnyParamAnnotated(annotationClass);
      for (Method method : paramMethods) {
        classNames.add(method.getDeclaringClass().getName());
      }
    }
    return AnnotationCache.create(getTimestamp(), annotationClass, classNames);
View Full Code Here

   * Restricted constructor
   */
  private ConfigTypesProvider() {
    Map<String, Class<?>> result = Maps.newHashMap();
    ImmutableSortedMap.Builder<String, String> descriptions = ImmutableSortedMap.naturalOrder();
    AnnotationReflector reflector = AnnotationReflector.getDefaultReflector();
    Set<Class<?>> configClasses = reflector.getReflector().getTypesAnnotatedWith(Config.class);
    for (Class<?> configClass : configClasses) {
      Annotation annotation = configClass.getAnnotation(Config.class);
      if (annotation instanceof Config) {
        Config configValueAnnotation = (Config) annotation;
        // extract config type
View Full Code Here

        .setUrls(ClasspathHelper.forManifest(ClasspathHelper.forJavaClassPath()))
        .setScanners(new TypeAnnotationsScanner(), new FieldAnnotationsScanner(), new SubTypesScanner(false))
        .filterInputsBy(FilterBuilder.parse(AnnotationReflector.DEFAULT_ANNOTATION_REFLECTOR_FILTER))
        .addClassLoaders(loaders)
        .useParallelExecutor();
      AnnotationReflector.initDefaultReflector(new AnnotationReflector(config));
      AnnotationReflector reflector = AnnotationReflector.getDefaultReflector();
     
      fudgeContext.getObjectDictionary().addAllAnnotatedBuilders(reflector);
      fudgeContext.getTypeDictionary().addAllAnnotatedSecondaryTypes(reflector);
     
      FudgeTypeDictionary td = fudgeContext.getTypeDictionary();
View Full Code Here

TOP

Related Classes of org.fudgemsg.AnnotationReflector

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.