FileDocCategorySizeDatePackage
AnnotationSourcer.javaAPI DocAndroid 1.5 API2243Wed May 06 22:41:10 BST 2009com.android.mkstubs.sourcer

AnnotationSourcer

public class AnnotationSourcer extends Object implements org.objectweb.asm.AnnotationVisitor
An annotation visitor that generates Java source for an annotation.

Fields Summary
private final String
mOpenChar
private final String
mCloseChar
private final Output
mOutput
private boolean
mNeedClose
Constructors Summary
public AnnotationSourcer(Output output)

        this(output, false /*isArray*/);
    
public AnnotationSourcer(Output output, boolean isArray)

        mOutput = output;
        mOpenChar = isArray ? "[" : "(";
        mCloseChar = isArray ? "]" : ")";
    
Methods Summary
private voidstartOpen()

        if (!mNeedClose) {
            mNeedClose = true;
            mOutput.write(mOpenChar);
        }
    
public voidvisit(java.lang.String name, java.lang.Object value)

        startOpen();

        if (name != null) {
            mOutput.write("%s=", name);
        }
        if (value != null) {
            mOutput.write(name.toString());
        }
    
public org.objectweb.asm.AnnotationVisitorvisitAnnotation(java.lang.String name, java.lang.String desc)

        startOpen();
        
        mOutput.write("@%s", name);
        return this;
    
public org.objectweb.asm.AnnotationVisitorvisitArray(java.lang.String name)

        startOpen();
        return new AnnotationSourcer(mOutput, true /*isArray*/);
    
public voidvisitEnd()

        if (mNeedClose) {
            mOutput.write(mCloseChar);
        }
        mOutput.write("\n");
    
public voidvisitEnum(java.lang.String name, java.lang.String desc, java.lang.String value)

        mOutput.write("/* annotation enum not supported: %s */\n", name);