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


Java Annotations.combine方法代码示例

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


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

示例1: getAnnotations0

import com.android.dx.rop.annotation.Annotations; //导入方法依赖的package包/类
/**
 * Helper method for {@link #getAnnotations} which just gets the
 * existing annotations, per se.
 *
 * @param attribs {@code non-null;} the attributes list to search in
 * @return {@code non-null;} the set of annotations, which may be empty
 */
private static Annotations getAnnotations0(AttributeList attribs) {
    AttRuntimeVisibleAnnotations visible =
        (AttRuntimeVisibleAnnotations)
        attribs.findFirst(AttRuntimeVisibleAnnotations.ATTRIBUTE_NAME);
    AttRuntimeInvisibleAnnotations invisible =
        (AttRuntimeInvisibleAnnotations)
        attribs.findFirst(AttRuntimeInvisibleAnnotations.ATTRIBUTE_NAME);

    if (visible == null) {
        if (invisible == null) {
            return Annotations.EMPTY;
        }
        return invisible.getAnnotations();
    }

    if (invisible == null) {
        return visible.getAnnotations();
    }

    // Both are non-null, so combine them.

    return Annotations.combine(visible.getAnnotations(),
            invisible.getAnnotations());
}
 
开发者ID:JLLK,项目名称:multidex-maker,代码行数:32,代码来源:AttributeTranslator.java

示例2: getAnnotations

import com.android.dx.rop.annotation.Annotations; //导入方法依赖的package包/类
/**
 * Gets the annotations out of a given {@link AttributeList}. This
 * combines both visible and invisible annotations into a single
 * result set and also adds in a system annotation for the
 * {@code Signature} attribute if present.
 *
 * @param attribs {@code non-null;} the attributes list to search in
 * @return {@code non-null;} the set of annotations, which may be empty
 */
public static Annotations getAnnotations(AttributeList attribs) {
    Annotations result = getAnnotations0(attribs);
    Annotation signature = getSignature(attribs);

    if (signature != null) {
        result = Annotations.combine(result, signature);
    }

    return result;
}
 
开发者ID:JLLK,项目名称:multidex-maker,代码行数:20,代码来源:AttributeTranslator.java

示例3: getClassAnnotations

import com.android.dx.rop.annotation.Annotations; //导入方法依赖的package包/类
/**
 * Gets the annotations out of a given class, similar to {@link
 * #getAnnotations}, also including annotations for translations
 * of class-level attributes {@code EnclosingMethod} and
 * {@code InnerClasses}, if present. Additionally, if the
 * class is an annotation class, then this also includes a
 * representation of all the {@code AnnotationDefault}
 * values.
 *
 * @param cf {@code non-null;} the class in question
 * @param args {@code non-null;} the high-level options
 * @return {@code non-null;} the set of annotations, which may be empty
 */
public static Annotations getClassAnnotations(DirectClassFile cf,
        CfOptions args) {
    CstType thisClass = cf.getThisClass();
    AttributeList attribs = cf.getAttributes();
    Annotations result = getAnnotations(attribs);
    Annotation enclosingMethod = translateEnclosingMethod(attribs);

    try {
        Annotations innerClassAnnotations =
            translateInnerClasses(thisClass, attribs,
                    enclosingMethod == null);
        if (innerClassAnnotations != null) {
            result = Annotations.combine(result, innerClassAnnotations);
        }
    } catch (Warning warn) {
        args.warn.println("warning: " + warn.getMessage());
    }

    if (enclosingMethod != null) {
        result = Annotations.combine(result, enclosingMethod);
    }

    if (AccessFlags.isAnnotation(cf.getAccessFlags())) {
        Annotation annotationDefault =
            translateAnnotationDefaults(cf);
        if (annotationDefault != null) {
            result = Annotations.combine(result, annotationDefault);
        }
    }

    return result;
}
 
开发者ID:JLLK,项目名称:multidex-maker,代码行数:46,代码来源:AttributeTranslator.java

示例4: getMethodAnnotations

import com.android.dx.rop.annotation.Annotations; //导入方法依赖的package包/类
/**
 * Gets the annotations out of a given method, similar to {@link
 * #getAnnotations}, also including an annotation for the translation
 * of the method-specific attribute {@code Exceptions}.
 *
 * @param method {@code non-null;} the method in question
 * @return {@code non-null;} the set of annotations, which may be empty
 */
public static Annotations getMethodAnnotations(Method method) {
    Annotations result = getAnnotations(method.getAttributes());
    TypeList exceptions = getExceptions(method);

    if (exceptions.size() != 0) {
        Annotation throwsAnnotation =
            AnnotationUtils.makeThrows(exceptions);
        result = Annotations.combine(result, throwsAnnotation);
    }

    return result;
}
 
开发者ID:JLLK,项目名称:multidex-maker,代码行数:21,代码来源:AttributeTranslator.java


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