Exemplo n.º 1
0
  private void createDeclaredViews(
      final Map<String, DesignDocument.View> views, final Class<?> klass) {
    eachAnnotation(
        klass,
        Views.class,
        new Predicate<Views>() {

          public boolean apply(Views input) {
            for (View v : input.value()) {
              addView(views, v, klass);
            }
            return true;
          }
        });

    ReflectionUtils.eachAnnotation(
        klass,
        View.class,
        new Predicate<View>() {

          public boolean apply(View input) {
            addView(views, input, klass);
            return true;
          }
        });
  }
Exemplo n.º 2
0
 private void expandSupertypes(Multimap<String, String> mmap, String key, Class<?> type) {
   for (Class<?> supertype : ReflectionUtils.getSuperTypes(type)) {
     if (mmap.put(supertype.getName(), key)) {
       if (log != null) log.debug("expanded subtype {} -> {}", supertype.getName(), key);
       expandSupertypes(mmap, supertype.getName(), supertype);
     }
   }
 }
Exemplo n.º 3
0
 private String resolveTypeDiscriminatorForBackReference(Member m) {
   Method me =
       ReflectionUtils.findMethod(
           m.getDeclaringClass(), "get" + firstCharToUpperCase(m.getName()));
   if (me != null) {
     return resolveTypeDiscriminator(resolveReturnType(me));
   }
   return "";
 }
Exemplo n.º 4
0
 /**
  * gets all sub types in hierarchy of a given type
  *
  * <p>depends on SubTypesScanner configured
  */
 public <T> Set<Class<? extends T>> getSubTypesOf(final Class<T> type) {
   return Sets.newHashSet(
       ReflectionUtils.<T>forNames(
           store.getAll(index(SubTypesScanner.class), Arrays.asList(type.getName())), loaders()));
 }