FileDocCategorySizeDatePackage
StdField.javaAPI DocAndroid 5.1 API2937Thu Mar 12 22:18:30 GMT 2015com.android.dexgen.rop

StdField

public final class StdField extends StdMember implements Field
Standard implementation of {@link Field}, which directly stores all the associated data.

Fields Summary
Constructors Summary
public StdField(com.android.dexgen.rop.cst.CstType definingClass, int accessFlags, com.android.dexgen.rop.cst.CstNat nat, AttributeList attributes)
Constructs an instance.

param
definingClass {@code non-null;} the defining class
param
accessFlags access flags
param
nat {@code non-null;} member name and type (descriptor)
param
attributes {@code non-null;} list of associated attributes

        super(definingClass, accessFlags, nat, attributes);
    
public StdField(Field field)
Constructs an instance having Java field as its pattern.

param
field {@code non-null;} pattern for dex field

        this(CstType.intern(field.getDeclaringClass()),
                field.getModifiers(),
                new CstNat(new CstUtf8(field.getName()),
                        CstType.intern(field.getType()).getDescriptor()),
                new StdAttributeList(0));
    
public StdField(Class definingClass, Class type, String name, int modifiers)
Constructs an instance taking field description as user-friendly arguments.

param
declaringClass {@code non-null;} the class field belongs to
param
type {@code non-null;} type of the field
param
name {@code non-null;} name of the field
param
modifiers access flags of the field

        this(CstType.intern(definingClass),
                modifiers,
                new CstNat(new CstUtf8(name), CstType.intern(type).getDescriptor()),
                new StdAttributeList(0));
    
Methods Summary
public com.android.dexgen.rop.cst.TypedConstantgetConstantValue()
{@inheritDoc}

        AttributeList attribs = getAttributes();
        AttConstantValue cval = (AttConstantValue)
            attribs.findFirst(AttConstantValue.ATTRIBUTE_NAME);

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

        return cval.getConstantValue();