Class AttributeFactory
java.lang.Object
com.android.dx.cf.direct.AttributeFactory
- Direct Known Subclasses:
StdAttributeFactory
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intcontext for attributes on class filesstatic final intcontext for attributes on code attributesstatic final intnumber of contextsstatic final intcontext for attributes on fieldsstatic final intcontext for attributes on methods -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal Attributeparse(DirectClassFile cf, int context, int offset, ParseObserver observer) Parses and makes an attribute based on the bytes at the indicated position in the given array.protected Attributeparse0(DirectClassFile cf, int context, String name, int offset, int length, ParseObserver observer) Parses attribute content.
-
Field Details
-
CTX_CLASS
public static final int CTX_CLASScontext for attributes on class files- See Also:
-
CTX_FIELD
public static final int CTX_FIELDcontext for attributes on fields- See Also:
-
CTX_METHOD
public static final int CTX_METHODcontext for attributes on methods- See Also:
-
CTX_CODE
public static final int CTX_CODEcontext for attributes on code attributes- See Also:
-
CTX_COUNT
public static final int CTX_COUNTnumber of contexts- See Also:
-
-
Constructor Details
-
AttributeFactory
public AttributeFactory()Constructs an instance.
-
-
Method Details
-
parse
Parses and makes an attribute based on the bytes at the indicated position in the given array. This method figures out the name, and then does all the setup to call on toparse0(DirectClassFile, int, String, int, int, ParseObserver), which does the actual construction.- Parameters:
cf-non-null;class file to parse fromcontext- context to parse in; one of theCTX_*constantsoffset- offset intodcf'sbytesto start parsing atobserver-null-ok;parse observer to report to, if any- Returns:
non-null;an appropriately-constructedAttribute
-
parse0
protected Attribute parse0(DirectClassFile cf, int context, String name, int offset, int length, ParseObserver observer) Parses attribute content. The base class implements this by constructing an instance ofRawAttribute. Subclasses are expected to override this to do something better in most cases.- Parameters:
cf-non-null;class file to parse fromcontext- context to parse in; one of theCTX_*constantsname-non-null;the attribute nameoffset- offset intobytesto start parsing at; this is the offset to the start of attribute data, not to the headerlength- the length of the attribute dataobserver-null-ok;parse observer to report to, if any- Returns:
non-null;an appropriately-constructedAttribute
-