com.google.inject.internal.Annotations.resolveMembers()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(3.7k)|赞(0)|评价(0)|浏览(107)

本文整理了Java中com.google.inject.internal.Annotations.resolveMembers()方法的一些代码示例,展示了Annotations.resolveMembers()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Annotations.resolveMembers()方法的具体详情如下:
包路径:com.google.inject.internal.Annotations
类名称:Annotations
方法名:resolveMembers

Annotations.resolveMembers介绍

暂无

代码示例

代码示例来源:origin: com.google.inject/guice

private static <T extends Annotation> T generateAnnotationImpl(final Class<T> annotationType) {
 final Map<String, Object> members = resolveMembers(annotationType);
 return annotationType.cast(
   Proxy.newProxyInstance(
     annotationType.getClassLoader(),
     new Class<?>[] {annotationType},
     new InvocationHandler() {
      @Override
      public Object invoke(Object proxy, Method method, Object[] args) throws Exception {
       String name = method.getName();
       if (name.equals("annotationType")) {
        return annotationType;
       } else if (name.equals("toString")) {
        return annotationToString(annotationType, members);
       } else if (name.equals("hashCode")) {
        return annotationHashCode(annotationType, members);
       } else if (name.equals("equals")) {
        return annotationEquals(annotationType, members, args[0]);
       } else {
        return members.get(name);
       }
      }
     }));
}

代码示例来源:origin: org.sonatype.sisu/sisu-guice

private static <T extends Annotation> T generateAnnotationImpl(final Class<T> annotationType) {
 final Map<String, Object> members = resolveMembers(annotationType);
 return annotationType.cast(
   Proxy.newProxyInstance(
     annotationType.getClassLoader(),
     new Class<?>[] {annotationType},
     new InvocationHandler() {
      @Override
      public Object invoke(Object proxy, Method method, Object[] args) throws Exception {
       String name = method.getName();
       if (name.equals("annotationType")) {
        return annotationType;
       } else if (name.equals("toString")) {
        return annotationToString(annotationType, members);
       } else if (name.equals("hashCode")) {
        return annotationHashCode(annotationType, members);
       } else if (name.equals("equals")) {
        return annotationEquals(annotationType, members, args[0]);
       } else {
        return members.get(name);
       }
      }
     }));
}

代码示例来源:origin: org.xbib/guice

private static <T extends Annotation> T generateAnnotationImpl(final Class<T> annotationType) {
  final Map<String, Object> members = resolveMembers(annotationType);
  return annotationType.cast(Proxy.newProxyInstance(
      annotationType.getClassLoader(),
      new Class<?>[]{annotationType},
      new InvocationHandler() {
        @Override
        public Object invoke(Object proxy, Method method, Object[] args) throws Exception {
          String name = method.getName();
          if (name.equals("annotationType")) {
            return annotationType;
          } else if (name.equals("toString")) {
            return annotationToString(annotationType, members);
          } else if (name.equals("hashCode")) {
            return annotationHashCode(annotationType, members);
          } else if (name.equals("equals")) {
            return annotationEquals(annotationType, members, args[0]);
          } else {
            return members.get(name);
          }
        }
      }));
}

代码示例来源:origin: com.jwebmp.inject/guice

private static <T extends Annotation> T generateAnnotationImpl(final Class<T> annotationType) {
 final Map<String, Object> members = resolveMembers(annotationType);
 return annotationType.cast(
   Proxy.newProxyInstance(
     annotationType.getClassLoader(),
     new Class<?>[] {annotationType},
     new InvocationHandler() {
      @Override
      public Object invoke(Object proxy, Method method, Object[] args) throws Exception {
       String name = method.getName();
       if (name.equals("annotationType")) {
        return annotationType;
       } else if (name.equals("toString")) {
        return annotationToString(annotationType, members);
       } else if (name.equals("hashCode")) {
        return annotationHashCode(annotationType, members);
       } else if (name.equals("equals")) {
        return annotationEquals(annotationType, members, args[0]);
       } else {
        return members.get(name);
       }
      }
     }));
}

相关文章