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


Java AttSignature类代码示例

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


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

示例1: signature

import com.android.dx.cf.attrib.AttSignature; //导入依赖的package包/类
/**
 * Parses a {@code Signature} attribute.
 */
private Attribute signature(DirectClassFile cf, int offset, int length,
        ParseObserver observer) {
    if (length != 2) {
        throwBadLength(2);
    }

    ByteArray bytes = cf.getBytes();
    ConstantPool pool = cf.getConstantPool();
    int idx = bytes.getUnsignedShort(offset);
    CstString cst = (CstString) pool.get(idx);
    Attribute result = new AttSignature(cst);

    if (observer != null) {
        observer.parsed(bytes, offset, 2, "signature: " + cst);
    }

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

示例2: getSignature

import com.android.dx.cf.attrib.AttSignature; //导入依赖的package包/类
/**
 * Gets the {@code Signature} attribute out of a given
 * {@link AttributeList}, if any, translating it to an annotation.
 *
 * @param attribs {@code non-null;} the attributes list to search in
 * @return {@code null-ok;} the converted {@code Signature} annotation,
 * if there was an attribute to translate
 */
private static Annotation getSignature(AttributeList attribs) {
    AttSignature signature = (AttSignature)
        attribs.findFirst(AttSignature.ATTRIBUTE_NAME);

    if (signature == null) {
        return null;
    }

    return AnnotationUtils.makeSignature(signature.getSignature());
}
 
开发者ID:JLLK,项目名称:multidex-maker,代码行数:19,代码来源:AttributeTranslator.java

示例3: processClass

import com.android.dx.cf.attrib.AttSignature; //导入依赖的package包/类
/**
 * Creates an XMLVM element for the given type and appends it to the given
 * root element.
 * 
 * @param cf
 *            the {@link DirectClassFile} instance of this class
 * @param root
 *            the root element to append the generated element to
 * @param referencedTypes
 *            will be filled with the types references in this class file
 * @return the generated element
 */
private Element processClass(DirectClassFile cf, Element root,
        Map<String, ReferenceKind> referencedTypes) {
    Element classElement = new Element("class", NS_XMLVM);
    CstType type = cf.getThisClass();
    PackagePlusClassName parsedClassName = parseClassName(type.getClassType().getClassName());
    addReference(referencedTypes, parsedClassName.toString(), ReferenceKind.SELF);
    classElement.setAttribute("name", parsedClassName.className);
    classElement.setAttribute("package", parsedClassName.packageName);
    String superClassName = "";

    // if we are an innerclass add the enclosingMethod
    AttEnclosingMethod enclosingMethodAnnotation = (AttEnclosingMethod) cf.getAttributes().findFirst(
            AttEnclosingMethod.ATTRIBUTE_NAME);

    if (enclosingMethodAnnotation != null) {
        CstType enclosingClass=enclosingMethodAnnotation.getEnclosingClass();
        CstNat enclosingMethod = enclosingMethodAnnotation.getMethod();
        if(enclosingClass!=null){
            addReference(referencedTypes, enclosingClass.toHuman(), ReferenceKind.USAGE);
            classElement.setAttribute("enclosingClass", enclosingClass.toHuman());
        }
        if(enclosingMethod!=null){
            classElement.setAttribute("enclosingMethod", enclosingMethod.toHuman());
        }
    }
    
    //get signature annotation if availabke
    AttSignature signatureAnnotation=(AttSignature) cf.getAttributes().findFirst(
            AttSignature.ATTRIBUTE_NAME);
    
    if(signatureAnnotation!=null){
        classElement.setAttribute("signature", signatureAnnotation.getSignature().toHuman());
    }
    
    // This can happen for java.lang.Object.
    if (cf.getSuperclass() != null) {
        superClassName = parseClassName(cf.getSuperclass().getClassType().getClassName())
                .toString();
        addReference(referencedTypes, superClassName, ReferenceKind.SUPER_CLASS);
    }

    classElement.setAttribute("extends", superClassName);

    processAccessFlags(cf.getAccessFlags(), classElement);

    TypeList interfaces = cf.getInterfaces();
    if (interfaces.size() > 0) {
        String interfaceList = "";
        for (int i = 0; i < interfaces.size(); ++i) {
            if (i > 0) {
                interfaceList += ",";
            }
            String interfaceName = parseClassName(interfaces.getType(i).getClassName())
                    .toString();
            interfaceList += interfaceName;
            addReference(referencedTypes, interfaceName, ReferenceKind.INTERFACE);
        }
        classElement.setAttribute("interfaces", interfaceList);
    }

    root.addContent(classElement);
    return classElement;
}
 
开发者ID:shannah,项目名称:cn1,代码行数:76,代码来源:DEXmlvmOutputProcess.java


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