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

FieldSourcer

public class FieldSourcer extends Object implements org.objectweb.asm.FieldVisitor
A field visitor that generates Java source defining a field.

Fields Summary
private final Output
mOutput
private final int
mAccess
private final String
mName
private final String
mDesc
private final String
mSignature
Constructors Summary
public FieldSourcer(Output output, int access, String name, String desc, String signature)

        mOutput = output;
        mAccess = access;
        mName = name;
        mDesc = desc;
        mSignature = signature;
    
Methods Summary
public org.objectweb.asm.AnnotationVisitorvisitAnnotation(java.lang.String desc, boolean visible)

        mOutput.write("@%s", desc);
        return new AnnotationSourcer(mOutput);
    
public voidvisitAttribute(org.objectweb.asm.Attribute attr)

        mOutput.write("%s /* non-standard attribute */ ", attr.type);
    
public voidvisitEnd()

        // Need to write type and field name after the annotations and attributes.

        AccessSourcer as = new AccessSourcer(mOutput);
        as.write(mAccess, AccessSourcer.IS_FIELD);
        
        if (mSignature == null) {
            mOutput.write(" %s", Type.getType(mDesc).getClassName());
        } else {
            mOutput.write(" ");
            SignatureReader sigReader = new SignatureReader(mSignature);
            SignatureSourcer sigSourcer = new SignatureSourcer();
            sigReader.acceptType(sigSourcer);
            mOutput.write(sigSourcer.toString());
        }

        mOutput.write(" %s", mName);

        mOutput.write(";\n");