Top Description Fields Constructors Methods
org.droidparts.dexmaker.dx.dex.file

public final Class AnnotationSetItem

extends OffsettedItem
Class Inheritance
Imports
org.droidparts.dexmaker.dx.rop.annotation.Annotation, .Annotations, org.droidparts.dexmaker.dx.util.AnnotatedOutput, .Hex

Set of annotations, where no annotation type appears more than once.

Field Summary

Modifier and TypeField and Description
private static final int
ALIGNMENT

the required alignment for instances of this class

private final Annotations
annotations

non-null; the set of annotations

private static final int
ENTRY_WRITE_SIZE

the size of an entry int the set: one uint

private final AnnotationItem[]
items

non-null; set of annotations as individual items in an array

Note

The contents have to get sorted by type id before writing.

Constructor Summary

AccessConstructor and Description
public
AnnotationSetItem(Annotations
non-null; set of annotations
annotations
)

Constructs an instance.

Method Summary

Modifier and TypeMethod and Description
public void
addContents(DexFile
non-null; the file to populate
file
)

Implements abstract org.droidparts.dexmaker.dx.dex.file.Item.addContents.

Populates a DexFile with items from within this instance.
protected int
compareTo0(OffsettedItem
non-null; instance to compare to
other
)

Overrides org.droidparts.dexmaker.dx.dex.file.OffsettedItem.compareTo0.

Compares this instance to another which is guaranteed to be of the same class.
public Annotations

Returns:

non-null; the annotations
getAnnotations
()

Gets the underlying annotations of this instance

public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for this object.
public ItemType
itemType()

Implements abstract org.droidparts.dexmaker.dx.dex.file.Item.itemType.

Returns the item type for this instance.
protected void
place0(Section
non-null; the section this instance has been added to
addedTo
,
int
>= 0; the offset from the start of the section where this instance was placed
offset
)

Overrides org.droidparts.dexmaker.dx.dex.file.OffsettedItem.place0.

Does additional work required when placing an instance.
public String
toHuman()

Implements abstract org.droidparts.dexmaker.dx.dex.file.OffsettedItem.toHuman.

Gets a short human-readable string representing this instance.
private static int

Returns:

> 0; the write size
writeSize
(Annotations
non-null; the set
annotations
)

Gets the write size for the given set.

protected void
writeTo0(DexFile
non-null; the file to use for reference
file
,
AnnotatedOutput
non-null; where to write to
out
)

Implements abstract org.droidparts.dexmaker.dx.dex.file.OffsettedItem.writeTo0.

Performs the actual write of the contents of this instance to the given data section.
Inherited from org.droidparts.dexmaker.dx.dex.file.OffsettedItem:
compareToequalsgetAbsoluteOffsetgetAbsoluteOffsetOr0getAlignmentgetRelativeOffsetoffsetStringplacesetWriteSizewriteSizewriteTo

Field Detail

ALIGNMENTback to summary
private static final int ALIGNMENT

the required alignment for instances of this class

annotationsback to summary
private final Annotations annotations

non-null; the set of annotations

ENTRY_WRITE_SIZEback to summary
private static final int ENTRY_WRITE_SIZE

the size of an entry int the set: one uint

itemsback to summary
private final AnnotationItem[] items

non-null; set of annotations as individual items in an array

Note

The contents have to get sorted by type id before writing.

Constructor Detail

AnnotationSetItemback to summary
public AnnotationSetItem(Annotations annotations)

Constructs an instance.

Parameters
annotations:Annotations

non-null; set of annotations

Method Detail

addContentsback to summary
public void addContents(DexFile file)

Implements abstract org.droidparts.dexmaker.dx.dex.file.Item.addContents.

Doc from org.droidparts.dexmaker.dx.dex.file.Item.addContents.

Populates a DexFile with items from within this instance. This will not add an item to the file for this instance itself (which should have been done by whatever refers to this instance).

Note

Subclasses must override this to do something appropriate.

Parameters
file:DexFile

non-null; the file to populate

compareTo0back to summary
protected int compareTo0(OffsettedItem other)

Overrides org.droidparts.dexmaker.dx.dex.file.OffsettedItem.compareTo0.

Doc from org.droidparts.dexmaker.dx.dex.file.OffsettedItem.compareTo0.

Compares this instance to another which is guaranteed to be of the same class. The default implementation of this method is to throw an exception (unsupported operation). If a particular class needs to actually sort, then it should override this method.

Parameters
other:OffsettedItem

non-null; instance to compare to

Returns:int

-1, 0, or 1, depending on the sort order of this instance and the other

Annotations
@Override
getAnnotationsback to summary
public Annotations getAnnotations()

Gets the underlying annotations of this instance

Returns:Annotations

non-null; the annotations

hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for this object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Returns:int

a hash code value for this object

Annotations
@Override
itemTypeback to summary
public ItemType itemType()

Implements abstract org.droidparts.dexmaker.dx.dex.file.Item.itemType.

Doc from org.droidparts.dexmaker.dx.dex.file.Item.itemType.

Returns the item type for this instance.

Returns:ItemType

non-null; the item type

Annotations
@Override
place0back to summary
protected void place0(Section addedTo, int offset)

Overrides org.droidparts.dexmaker.dx.dex.file.OffsettedItem.place0.

Doc from org.droidparts.dexmaker.dx.dex.file.OffsettedItem.place0.

Does additional work required when placing an instance. The default implementation of this method is a no-op. If a particular class needs to do something special, then it should override this method. In particular, if this instance did not know its write size up-front, then this method is responsible for setting it.

Parameters
addedTo:Section

non-null; the section this instance has been added to

offset:int

>= 0; the offset from the start of the section where this instance was placed

Annotations
@Override
toHumanback to summary
public String toHuman()

Implements abstract org.droidparts.dexmaker.dx.dex.file.OffsettedItem.toHuman.

Doc from org.droidparts.dexmaker.dx.dex.file.OffsettedItem.toHuman.

Gets a short human-readable string representing this instance.

Returns:String

non-null; the human form

Annotations
@Override
writeSizeback to summary
private static int writeSize(Annotations annotations)

Gets the write size for the given set.

Parameters
annotations:Annotations

non-null; the set

Returns:int

> 0; the write size

writeTo0back to summary
protected void writeTo0(DexFile file, AnnotatedOutput out)

Implements abstract org.droidparts.dexmaker.dx.dex.file.OffsettedItem.writeTo0.

Doc from org.droidparts.dexmaker.dx.dex.file.OffsettedItem.writeTo0.

Performs the actual write of the contents of this instance to the given data section. This is called by writeTo, which will have taken care of ensuring alignment.

Parameters
file:DexFile

non-null; the file to use for reference

out:AnnotatedOutput

non-null; where to write to

Annotations
@Override