当前位置: 首页>>代码示例>>Java>>正文


Java AccessibleObject.isAnnotationPresent方法代码示例

本文整理汇总了Java中java.lang.reflect.AccessibleObject.isAnnotationPresent方法的典型用法代码示例。如果您正苦于以下问题:Java AccessibleObject.isAnnotationPresent方法的具体用法?Java AccessibleObject.isAnnotationPresent怎么用?Java AccessibleObject.isAnnotationPresent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.lang.reflect.AccessibleObject的用法示例。


在下文中一共展示了AccessibleObject.isAnnotationPresent方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createDynamicMethod

import java.lang.reflect.AccessibleObject; //导入方法依赖的package包/类
/**
 * Given a reflective method or a constructor, creates a dynamic method that represents it. This method will
 * distinguish between caller sensitive and ordinary methods/constructors, and create appropriate caller sensitive
 * dynamic method when needed.
 * @param m the reflective member
 * @return the single dynamic method representing the reflective member
 */
private static SingleDynamicMethod createDynamicMethod(final AccessibleObject m) {
    if (m.isAnnotationPresent(CallerSensitive.class)) {
        // Method has @CallerSensitive annotation
        return new CallerSensitiveDynamicMethod(m);
    }
    // Method has no @CallerSensitive annotation
    final MethodHandle mh;
    try {
        mh = unreflectSafely(m);
    } catch (final IllegalAccessError e) {
        // java.lang.invoke can in some case conservatively treat as caller sensitive methods that aren't
        // marked with the annotation. In this case, we'll fall back to treating it as caller sensitive.
        return new CallerSensitiveDynamicMethod(m);
    }
    // Proceed with non-caller sensitive
    final Member member = (Member)m;
    return new SimpleDynamicMethod(mh, member.getDeclaringClass(), member.getName(), m instanceof Constructor);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:26,代码来源:AbstractJavaLinker.java

示例2: annotatedName

import java.lang.reflect.AccessibleObject; //导入方法依赖的package包/类
private static String annotatedName(AccessibleObject obj) {
  if (obj.isAnnotationPresent(PropertyName.class)) {
    PropertyName annotation = obj.getAnnotation(PropertyName.class);
    return annotation.value();
  }

  return null;
}
 
开发者ID:firebase,项目名称:firebase-admin-java,代码行数:9,代码来源:CustomClassMapper.java

示例3: findAnnotatedMember

import java.lang.reflect.AccessibleObject; //导入方法依赖的package包/类
private static Member findAnnotatedMember(AccessibleObject[] members,
                                          Class<? extends Annotation> annotation) {
    for (AccessibleObject member : members) {
        if (member.isAnnotationPresent(annotation)) {
            return (Member) member;
        }
    }
    return null;
}
 
开发者ID:MikaGuraN,项目名称:HL4A,代码行数:10,代码来源:ScriptableObject.java

示例4: getCascadeTypes

import java.lang.reflect.AccessibleObject; //导入方法依赖的package包/类
private CascadeType[] getCascadeTypes(AccessibleObject accessibleObject) {
    CascadeType[] cascadeTypes = null;
    if(accessibleObject.isAnnotationPresent(OneToMany.class)) {
        cascadeTypes = accessibleObject.getAnnotation(OneToMany.class).cascade();
    }else if(accessibleObject.isAnnotationPresent(ManyToOne.class)) {
        cascadeTypes = accessibleObject.getAnnotation(ManyToOne.class).cascade();
    }else if(accessibleObject.isAnnotationPresent(ManyToMany.class)) {
        cascadeTypes = accessibleObject.getAnnotation(ManyToMany.class).cascade();
    }
    return cascadeTypes;
}
 
开发者ID:chaokunyang,项目名称:jkes,代码行数:12,代码来源:EventSupport.java

示例5: isCallerSensitive

import java.lang.reflect.AccessibleObject; //导入方法依赖的package包/类
private static boolean isCallerSensitive(final AccessibleObject e) {
    return e.isAnnotationPresent(CallerSensitive.class);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:4,代码来源:JavaAdapterBytecodeGenerator.java


注:本文中的java.lang.reflect.AccessibleObject.isAnnotationPresent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。