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


Java AnnotationsList类代码示例

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


AnnotationsList类属于com.android.dx.rop.annotation包,在下文中一共展示了AnnotationsList类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: BaseParameterAnnotations

import com.android.dx.rop.annotation.AnnotationsList; //导入依赖的package包/类
/**
 * Constructs an instance.
 *
 * @param attributeName {@code non-null;} the name of the attribute
 * @param parameterAnnotations {@code non-null;} the annotations
 * @param byteLength {@code >= 0;} attribute data length in the original
 * classfile (not including the attribute header)
 */
public BaseParameterAnnotations(String attributeName,
        AnnotationsList parameterAnnotations, int byteLength) {
    super(attributeName);

    try {
        if (parameterAnnotations.isMutable()) {
            throw new MutabilityException(
                    "parameterAnnotations.isMutable()");
        }
    } catch (NullPointerException ex) {
        // Translate the exception.
        throw new NullPointerException("parameterAnnotations == null");
    }

    this.parameterAnnotations = parameterAnnotations;
    this.byteLength = byteLength;
}
 
开发者ID:JLLK,项目名称:multidex-maker,代码行数:26,代码来源:BaseParameterAnnotations.java

示例2: parseParameterAttribute

import com.android.dx.rop.annotation.AnnotationsList; //导入依赖的package包/类
/**
 * Parses a parameter annotation attribute.
 *
 * @param visibility {@code non-null;} visibility of the parsed annotations
 * @return {@code non-null;} the parsed list of lists of annotations
 */
public AnnotationsList parseParameterAttribute(
        AnnotationVisibility visibility) {
    AnnotationsList result;

    try {
        result = parseAnnotationsList(visibility);

        if (input.available() != 0) {
            throw new ParseException("extra data in attribute");
        }
    } catch (IOException ex) {
        // ByteArray.MyDataInputStream should never throw.
        throw new RuntimeException("shouldn't happen", ex);
    }

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

示例3: getParameterAnnotations

import com.android.dx.rop.annotation.AnnotationsList; //导入依赖的package包/类
/**
 * Gets the parameter annotations out of a given method. This
 * combines both visible and invisible annotations into a single
 * result set.
 *
 * @param method {@code non-null;} the method in question
 * @return {@code non-null;} the list of annotation sets, which may be
 * empty
 */
public static AnnotationsList getParameterAnnotations(Method method) {
    AttributeList attribs = method.getAttributes();
    AttRuntimeVisibleParameterAnnotations visible =
        (AttRuntimeVisibleParameterAnnotations)
        attribs.findFirst(
                AttRuntimeVisibleParameterAnnotations.ATTRIBUTE_NAME);
    AttRuntimeInvisibleParameterAnnotations invisible =
        (AttRuntimeInvisibleParameterAnnotations)
        attribs.findFirst(
                AttRuntimeInvisibleParameterAnnotations.ATTRIBUTE_NAME);

    if (visible == null) {
        if (invisible == null) {
            return AnnotationsList.EMPTY;
        }
        return invisible.getParameterAnnotations();
    }

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

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

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

示例4: addParameterAnnotations

import com.android.dx.rop.annotation.AnnotationsList; //导入依赖的package包/类
/**
 * Adds a parameter annotations item to this instance.
 *
 * @param method {@code non-null;} method in question
 * @param list {@code non-null;} associated list of annotation sets to add
 * @param dexFile {@code non-null;} dex output
 */
public void addParameterAnnotations(CstMethodRef method,
        AnnotationsList list, DexFile dexFile) {
    if (parameterAnnotations == null) {
        parameterAnnotations = new ArrayList<ParameterAnnotationStruct>();
    }

    parameterAnnotations.add(new ParameterAnnotationStruct(method, list, dexFile));
}
 
开发者ID:JLLK,项目名称:multidex-maker,代码行数:16,代码来源:AnnotationsDirectoryItem.java

示例5: getParameterAnnotations

import com.android.dx.rop.annotation.AnnotationsList; //导入依赖的package包/类
/**
 * Gets the parameter annotations for a given method, if any. This is
 * meant for use by debugging / dumping code.
 *
 * @param method {@code non-null;} the method
 * @return {@code null-ok;} the parameter annotations, if any
 */
public AnnotationsList getParameterAnnotations(CstMethodRef method) {
    if (parameterAnnotations == null) {
        return null;
    }

    for (ParameterAnnotationStruct item : parameterAnnotations) {
        if (item.getMethod().equals(method)) {
            return item.getAnnotationsList();
        }
    }

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

示例6: ParameterAnnotationStruct

import com.android.dx.rop.annotation.AnnotationsList; //导入依赖的package包/类
/**
 * Constructs an instance.
 *
 * @param method {@code non-null;} the method in question
 * @param annotationsList {@code non-null;} the associated annotations list
 * @param dexFile {@code non-null;} dex output
 */
public ParameterAnnotationStruct(CstMethodRef method,
        AnnotationsList annotationsList, DexFile dexFile) {
    if (method == null) {
        throw new NullPointerException("method == null");
    }

    if (annotationsList == null) {
        throw new NullPointerException("annotationsList == null");
    }

    this.method = method;
    this.annotationsList = annotationsList;

    /*
     * Construct an item for the annotations list. TODO: This
     * requires way too much copying; fix it.
     */

    int size = annotationsList.size();
    ArrayList<AnnotationSetRefItem> arrayList = new
        ArrayList<AnnotationSetRefItem>(size);

    for (int i = 0; i < size; i++) {
        Annotations annotations = annotationsList.get(i);
        AnnotationSetItem item = new AnnotationSetItem(annotations, dexFile);
        arrayList.add(new AnnotationSetRefItem(item));
    }

    this.annotationsItem = new UniformListItem<AnnotationSetRefItem>(
            ItemType.TYPE_ANNOTATION_SET_REF_LIST, arrayList);
}
 
开发者ID:JLLK,项目名称:multidex-maker,代码行数:39,代码来源:ParameterAnnotationStruct.java

示例7: parseAnnotationsList

import com.android.dx.rop.annotation.AnnotationsList; //导入依赖的package包/类
/**
 * Parses a list of annotation lists.
 *
 * @param visibility {@code non-null;} visibility of the parsed annotations
 * @return {@code non-null;} the list of annotation lists read from the attribute
 * data
 */
private AnnotationsList parseAnnotationsList(
        AnnotationVisibility visibility) throws IOException {
    int count = input.readUnsignedByte();

    if (observer != null) {
        parsed(1, "num_parameters: " + Hex.u1(count));
    }

    AnnotationsList outerList = new AnnotationsList(count);

    for (int i = 0; i < count; i++) {
        if (observer != null) {
            parsed(0, "parameter_annotations[" + i + "]:");
            changeIndent(1);
        }

        Annotations annotations = parseAnnotations(visibility);
        outerList.set(i, annotations);

        if (observer != null) {
            observer.changeIndent(-1);
        }
    }

    outerList.setImmutable();
    return outerList;
}
 
开发者ID:JLLK,项目名称:multidex-maker,代码行数:35,代码来源:AnnotationParser.java

示例8: runtimeInvisibleParameterAnnotations

import com.android.dx.rop.annotation.AnnotationsList; //导入依赖的package包/类
/**
 * Parses a {@code RuntimeInvisibleParameterAnnotations} attribute.
 */
private Attribute runtimeInvisibleParameterAnnotations(DirectClassFile cf,
        int offset, int length, ParseObserver observer) {
    if (length < 2) {
        throwSeverelyTruncated();
    }

    AnnotationParser ap =
        new AnnotationParser(cf, offset, length, observer);
    AnnotationsList list =
        ap.parseParameterAttribute(AnnotationVisibility.BUILD);

    return new AttRuntimeInvisibleParameterAnnotations(list, length);
}
 
开发者ID:JLLK,项目名称:multidex-maker,代码行数:17,代码来源:StdAttributeFactory.java

示例9: runtimeVisibleParameterAnnotations

import com.android.dx.rop.annotation.AnnotationsList; //导入依赖的package包/类
/**
 * Parses a {@code RuntimeVisibleParameterAnnotations} attribute.
 */
private Attribute runtimeVisibleParameterAnnotations(DirectClassFile cf,
        int offset, int length, ParseObserver observer) {
    if (length < 2) {
        throwSeverelyTruncated();
    }

    AnnotationParser ap =
        new AnnotationParser(cf, offset, length, observer);
    AnnotationsList list =
        ap.parseParameterAttribute(AnnotationVisibility.RUNTIME);

    return new AttRuntimeVisibleParameterAnnotations(list, length);
}
 
开发者ID:JLLK,项目名称:multidex-maker,代码行数:17,代码来源:StdAttributeFactory.java

示例10: addParameterAnnotations

import com.android.dx.rop.annotation.AnnotationsList; //导入依赖的package包/类
/**
 * Adds a parameter annotations item to this instance.
 *
 * @param method {@code non-null;} method in question
 * @param list {@code non-null;} associated list of annotation sets to add
 */
public void addParameterAnnotations(CstMethodRef method,
        AnnotationsList list) {
    if (parameterAnnotations == null) {
        parameterAnnotations = new ArrayList<ParameterAnnotationStruct>();
    }

    parameterAnnotations.add(new ParameterAnnotationStruct(method, list));
}
 
开发者ID:AndreJCL,项目名称:JCL,代码行数:15,代码来源:AnnotationsDirectoryItem.java

示例11: ParameterAnnotationStruct

import com.android.dx.rop.annotation.AnnotationsList; //导入依赖的package包/类
/**
 * Constructs an instance.
 *
 * @param method {@code non-null;} the method in question
 * @param annotationsList {@code non-null;} the associated annotations list
 */
public ParameterAnnotationStruct(CstMethodRef method,
        AnnotationsList annotationsList) {
    if (method == null) {
        throw new NullPointerException("method == null");
    }

    if (annotationsList == null) {
        throw new NullPointerException("annotationsList == null");
    }

    this.method = method;
    this.annotationsList = annotationsList;

    /*
     * Construct an item for the annotations list. TODO: This
     * requires way too much copying; fix it.
     */

    int size = annotationsList.size();
    ArrayList<AnnotationSetRefItem> arrayList = new
        ArrayList<AnnotationSetRefItem>(size);

    for (int i = 0; i < size; i++) {
        Annotations annotations = annotationsList.get(i);
        AnnotationSetItem item = new AnnotationSetItem(annotations);
        arrayList.add(new AnnotationSetRefItem(item));
    }

    this.annotationsItem = new UniformListItem<AnnotationSetRefItem>(
            ItemType.TYPE_ANNOTATION_SET_REF_LIST, arrayList);
}
 
开发者ID:AndreJCL,项目名称:JCL,代码行数:38,代码来源:ParameterAnnotationStruct.java


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