Add a common superclass for Annotation and AnnotationEncodedValue

This commit is contained in:
Ben Gruver 2013-05-28 11:04:57 -07:00
parent 13705697c2
commit 9ed12bac38
3 changed files with 30 additions and 2 deletions

View File

@ -38,7 +38,7 @@ import java.util.Set;
/** /**
* This class represents a specific instance of an annotation applied to a class/field/method/parameter * This class represents a specific instance of an annotation applied to a class/field/method/parameter
*/ */
public interface Annotation extends Comparable<Annotation> { public interface Annotation extends BasicAnnotation, Comparable<Annotation> {
/** /**
* Gets the visibility of this annotation. * Gets the visibility of this annotation.
* *

View File

@ -0,0 +1,27 @@
package org.jf.dexlib2.iface;
import javax.annotation.Nonnull;
import java.util.Set;
/**
* This represents a basic annotation, and serves as a common superclass for Annotation and AnnotationEncodedValue
*/
public interface BasicAnnotation {
/**
* Gets the type of this annotation.
*
* This will be the type descriptor of the class that defines this annotation.
*
* @return The type of this annotation
*/
@Nonnull String getType();
/**
* Gets a set of the name/value elements associated with this annotation.
*
* The elements in the returned set will be unique with respect to the element name.
*
* @return A set of AnnotationElements
*/
@Nonnull Set<? extends AnnotationElement> getElements();
}

View File

@ -32,6 +32,7 @@
package org.jf.dexlib2.iface.value; package org.jf.dexlib2.iface.value;
import org.jf.dexlib2.iface.AnnotationElement; import org.jf.dexlib2.iface.AnnotationElement;
import org.jf.dexlib2.iface.BasicAnnotation;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import javax.annotation.Nullable; import javax.annotation.Nullable;
@ -40,7 +41,7 @@ import java.util.Set;
/** /**
* This class represents an encoded annotation value. * This class represents an encoded annotation value.
*/ */
public interface AnnotationEncodedValue extends EncodedValue { public interface AnnotationEncodedValue extends EncodedValue, BasicAnnotation {
/** /**
* Gets the type of this annotation. * Gets the type of this annotation.
* *