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


Java Type.getComponentType方法代码示例

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


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

示例1: opNewArray

import com.android.dx.rop.type.Type; //导入方法依赖的package包/类
/**
 * Returns the appropriate {@code new-array} rop for the given
 * type. The result is a shared instance.
 *
 * @param arrayType {@code non-null;} array type of array being created
 * @return {@code non-null;} an appropriate instance
 */
public static Rop opNewArray(TypeBearer arrayType) {
    Type type = arrayType.getType();
    Type elementType = type.getComponentType();

    switch (elementType.getBasicType()) {
        case Type.BT_INT:     return NEW_ARRAY_INT;
        case Type.BT_LONG:    return NEW_ARRAY_LONG;
        case Type.BT_FLOAT:   return NEW_ARRAY_FLOAT;
        case Type.BT_DOUBLE:  return NEW_ARRAY_DOUBLE;
        case Type.BT_BOOLEAN: return NEW_ARRAY_BOOLEAN;
        case Type.BT_BYTE:    return NEW_ARRAY_BYTE;
        case Type.BT_CHAR:    return NEW_ARRAY_CHAR;
        case Type.BT_SHORT:   return NEW_ARRAY_SHORT;
        case Type.BT_OBJECT: {
            return new Rop(RegOps.NEW_ARRAY, type, StdTypeList.INT,
                    Exceptions.LIST_Error_NegativeArraySizeException,
                    "new-array-object");
        }
    }

    return throwBadType(type);
}
 
开发者ID:JLLK,项目名称:multidex-maker,代码行数:30,代码来源:Rops.java

示例2: opFilledNewArray

import com.android.dx.rop.type.Type; //导入方法依赖的package包/类
/**
 * Returns the appropriate {@code filled-new-array} rop for the given
 * type. The result may be a shared instance.
 *
 * @param arrayType {@code non-null;} type of array being created
 * @param count {@code >= 0;} number of elements that the array should have
 * @return {@code non-null;} an appropriate instance
 */
public static Rop opFilledNewArray(TypeBearer arrayType, int count) {
    Type type = arrayType.getType();
    Type elementType = type.getComponentType();

    if (elementType.isCategory2()) {
        return throwBadType(arrayType);
    }

    if (count < 0) {
        throw new IllegalArgumentException("count < 0");
    }

    StdTypeList sourceTypes = new StdTypeList(count);

    for (int i = 0; i < count; i++) {
        sourceTypes.set(i, elementType);
    }

    // Note: The resulting rop is considered call-like.
    return new Rop(RegOps.FILLED_NEW_ARRAY,
                   sourceTypes,
                   Exceptions.LIST_Error);
}
 
开发者ID:JLLK,项目名称:multidex-maker,代码行数:32,代码来源:Rops.java


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