From b02edf521c5554eed8759dbb24baea3da41510f9 Mon Sep 17 00:00:00 2001 From: Ben Gruver Date: Tue, 1 Jan 2013 16:48:21 -0800 Subject: [PATCH] Add javadoc for the AnnotationIterator class --- .../dexbacked/util/AnnotationsDirectory.java | 28 ++++++++++++++++--- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/dexlib2/src/main/java/org/jf/dexlib2/dexbacked/util/AnnotationsDirectory.java b/dexlib2/src/main/java/org/jf/dexlib2/dexbacked/util/AnnotationsDirectory.java index dd13b06b..25882500 100644 --- a/dexlib2/src/main/java/org/jf/dexlib2/dexbacked/util/AnnotationsDirectory.java +++ b/dexlib2/src/main/java/org/jf/dexlib2/dexbacked/util/AnnotationsDirectory.java @@ -64,14 +64,34 @@ public abstract class AnnotationsDirectory { return new AnnotationsDirectoryImpl(dexFile, directoryAnnotationsOffset); } - + /** + * This provides a forward-only, skipable iteration over the field_annotation, method_annotation or + * parameter_annotation lists in an annotations_directory_item. + * + * These lists associate a key, either a field or method index, with an offset to where the annotation data for + * that field/method/parameter is stored. + */ public interface AnnotationIterator { public static final AnnotationIterator EMPTY = new AnnotationIterator() { - @Override public int seekTo(int fieldIndex) { return 0; } - public void reset() {} + @Override public int seekTo(int key) { return 0; } + @Override public void reset() {} }; - public int seekTo(int fieldIndex); + /** + * Seeks the iterator forward, to the first item whose key is >= the requested key. If the requested key value + * is less than that of the item that the iterator currently points to, it will not be moved forward. + * + * If an item with the requested key is found, the associated annotation offset is returned. Otherwise, 0 is + * returned. + * + * @param key The method/field index to search for + * @return The annotation offset associated with the requested key, or 0 if not found. + */ + public int seekTo(int key); + + /** + * Resets the iterator to the beginning of its list. + */ public void reset(); }