Search in sources :

Example 1 with NameValuePair

use of com.taobao.android.dx.rop.annotation.NameValuePair in project atlas by alibaba.

the class AnnotationParser method parseElement.

/**
     * Parses a {@link NameValuePair}.
     *
     * @return {@code non-null;} the parsed element
     */
private NameValuePair parseElement() throws IOException {
    requireLength(5);
    int elementNameIndex = input.readUnsignedShort();
    CstString elementName = (CstString) pool.get(elementNameIndex);
    if (observer != null) {
        parsed(2, "element_name: " + elementName.toHuman());
        parsed(0, "value: ");
        changeIndent(1);
    }
    Constant value = parseValue();
    if (observer != null) {
        changeIndent(-1);
    }
    return new NameValuePair(elementName, value);
}
Also used : NameValuePair(com.taobao.android.dx.rop.annotation.NameValuePair) Constant(com.taobao.android.dx.rop.cst.Constant) CstString(com.taobao.android.dx.rop.cst.CstString)

Example 2 with NameValuePair

use of com.taobao.android.dx.rop.annotation.NameValuePair in project atlas by alibaba.

the class AnnotationUtils method makeEnclosingClass.

/**
     * Constructs a standard {@code EnclosingClass} annotation.
     *
     * @param clazz {@code non-null;} the enclosing class
     * @return {@code non-null;} the annotation
     */
public static Annotation makeEnclosingClass(CstType clazz) {
    Annotation result = new Annotation(ENCLOSING_CLASS_TYPE, SYSTEM);
    result.put(new NameValuePair(VALUE_STRING, clazz));
    result.setImmutable();
    return result;
}
Also used : NameValuePair(com.taobao.android.dx.rop.annotation.NameValuePair) Annotation(com.taobao.android.dx.rop.annotation.Annotation) CstAnnotation(com.taobao.android.dx.rop.cst.CstAnnotation)

Example 3 with NameValuePair

use of com.taobao.android.dx.rop.annotation.NameValuePair in project atlas by alibaba.

the class AnnotationUtils method makeInnerClass.

/**
     * Constructs a standard {@code InnerClass} annotation.
     *
     * @param name {@code null-ok;} the original name of the class, or
     * {@code null} to represent an anonymous class
     * @param accessFlags the original access flags
     * @return {@code non-null;} the annotation
     */
public static Annotation makeInnerClass(CstString name, int accessFlags) {
    Annotation result = new Annotation(INNER_CLASS_TYPE, SYSTEM);
    Constant nameCst = (name != null) ? name : CstKnownNull.THE_ONE;
    result.put(new NameValuePair(NAME_STRING, nameCst));
    result.put(new NameValuePair(ACCESS_FLAGS_STRING, CstInteger.make(accessFlags)));
    result.setImmutable();
    return result;
}
Also used : NameValuePair(com.taobao.android.dx.rop.annotation.NameValuePair) Constant(com.taobao.android.dx.rop.cst.Constant) Annotation(com.taobao.android.dx.rop.annotation.Annotation) CstAnnotation(com.taobao.android.dx.rop.cst.CstAnnotation)

Example 4 with NameValuePair

use of com.taobao.android.dx.rop.annotation.NameValuePair in project atlas by alibaba.

the class AnnotationUtils method makeAnnotationDefault.

/**
     * Constructs a standard {@code AnnotationDefault} annotation.
     *
     * @param defaults {@code non-null;} the defaults, itself as an annotation
     * @return {@code non-null;} the constructed annotation
     */
public static Annotation makeAnnotationDefault(Annotation defaults) {
    Annotation result = new Annotation(ANNOTATION_DEFAULT_TYPE, SYSTEM);
    result.put(new NameValuePair(VALUE_STRING, new CstAnnotation(defaults)));
    result.setImmutable();
    return result;
}
Also used : NameValuePair(com.taobao.android.dx.rop.annotation.NameValuePair) CstAnnotation(com.taobao.android.dx.rop.cst.CstAnnotation) Annotation(com.taobao.android.dx.rop.annotation.Annotation) CstAnnotation(com.taobao.android.dx.rop.cst.CstAnnotation)

Example 5 with NameValuePair

use of com.taobao.android.dx.rop.annotation.NameValuePair in project atlas by alibaba.

the class AnnotationUtils method makeMemberClasses.

/**
     * Constructs a standard {@code MemberClasses} annotation.
     *
     * @param types {@code non-null;} the list of (the types of) the member classes
     * @return {@code non-null;} the annotation
     */
public static Annotation makeMemberClasses(TypeList types) {
    CstArray array = makeCstArray(types);
    Annotation result = new Annotation(MEMBER_CLASSES_TYPE, SYSTEM);
    result.put(new NameValuePair(VALUE_STRING, array));
    result.setImmutable();
    return result;
}
Also used : NameValuePair(com.taobao.android.dx.rop.annotation.NameValuePair) CstArray(com.taobao.android.dx.rop.cst.CstArray) Annotation(com.taobao.android.dx.rop.annotation.Annotation) CstAnnotation(com.taobao.android.dx.rop.cst.CstAnnotation)

Aggregations

NameValuePair (com.taobao.android.dx.rop.annotation.NameValuePair)13 Annotation (com.taobao.android.dx.rop.annotation.Annotation)9 CstAnnotation (com.taobao.android.dx.rop.cst.CstAnnotation)8 CstString (com.taobao.android.dx.rop.cst.CstString)5 Constant (com.taobao.android.dx.rop.cst.Constant)4 CstArray (com.taobao.android.dx.rop.cst.CstArray)3 CstType (com.taobao.android.dx.rop.cst.CstType)3 AttAnnotationDefault (com.taobao.android.dx.cf.attrib.AttAnnotationDefault)1 AttEnclosingMethod (com.taobao.android.dx.cf.attrib.AttEnclosingMethod)1 AttributeList (com.taobao.android.dx.cf.iface.AttributeList)1 Method (com.taobao.android.dx.cf.iface.Method)1 MethodList (com.taobao.android.dx.cf.iface.MethodList)1 TypeList (com.taobao.android.dx.rop.type.TypeList)1 ArrayList (java.util.ArrayList)1