improved documentation

This commit is contained in:
Manu Sridharan 2012-08-21 16:55:30 -07:00
parent 7630cd79c9
commit 800203a71f
3 changed files with 43 additions and 8 deletions

View File

@ -1,5 +1,5 @@
<HTML> <HTML>
<BODY> <BODY>
This package supports summaries of synthetic methods. This package provides functionality related to class hierarchies.
</BODY> </BODY>
</HTML> </HTML>

View File

@ -131,14 +131,27 @@ public class Annotation {
return true; return true;
} }
/**
* Get the unnamed arguments to the annotation (e.g., constructor arguments
* for C# attributes), represented as an array of pairs (T,V), where T is the
* argument type and V is the value. The array preserves the order in which
* the arguments were passed. If null, there are no unnamed arguments.
*/
public Pair<TypeReference, Object>[] getUnnamedArguments() { public Pair<TypeReference, Object>[] getUnnamedArguments() {
return unnamedArguments; return unnamedArguments;
} }
/**
* Get the named arguments to the annotation, represented as a mapping from
* name to value
*/
public Map<String,ElementValue> getNamedArguments() { public Map<String,ElementValue> getNamedArguments() {
return namedArguments; return namedArguments;
} }
/**
* Get the type of the annotation
*/
public TypeReference getType() { public TypeReference getType() {
return type; return type;
} }

View File

@ -78,12 +78,15 @@ public class AnnotationsReader extends AttributeReader {
} }
/** /**
* @see AnnotationsReader#readElementValueAndSize(int) * Represents a constant argument to an annotation. Class arguments (e.g.,
* * <code>Foo.class</code>) are also represented with this type, with the value
* * being the String class name.
*/ */
public static class ConstantElementValue implements ElementValue { public static class ConstantElementValue implements ElementValue {
/**
* the constant value
*/
public final Object val; public final Object val;
public ConstantElementValue(Object val) { public ConstantElementValue(Object val) {
@ -98,10 +101,18 @@ public class AnnotationsReader extends AttributeReader {
} }
/** /**
* @see AnnotationsReader#readElementValueAndSize(int) * Represents enum constant annotation arguments.
*/ */
public static class EnumElementValue implements ElementValue { public static class EnumElementValue implements ElementValue {
/**
* the name of the enum type
*/
public final String enumType; public final String enumType;
/**
* the enum value
*/
public final String enumVal; public final String enumVal;
public EnumElementValue(String enumType, String enumVal) { public EnumElementValue(String enumType, String enumVal) {
@ -118,10 +129,13 @@ public class AnnotationsReader extends AttributeReader {
} }
/** /**
* @see AnnotationsReader#readElementValueAndSize(int) * represents an annotation argument that itself is an array of arguments
*/ */
public static class ArrayElementValue implements ElementValue { public static class ArrayElementValue implements ElementValue {
/**
* the values contained in the array
*/
public final ElementValue[] vals; public final ElementValue[] vals;
public ArrayElementValue(ElementValue[] vals) { public ArrayElementValue(ElementValue[] vals) {
@ -195,12 +209,20 @@ public class AnnotationsReader extends AttributeReader {
* } element_value_pairs[num_element_value_pairs]; * } element_value_pairs[num_element_value_pairs];
* </pre> * </pre>
* *
* See the JVM spec section 4.7.16 for details. * See the JVM specification section 4.7.16 for details.
*
* This class implements {@link ElementValue} to handle nested annotations.
*/ */
public static class AnnotationAttribute implements ElementValue { public static class AnnotationAttribute implements ElementValue {
/**
* the type of the annotation
*/
public final String type; public final String type;
/**
* the arguments to the annotation
*/
public final Map<String, ElementValue> elementValues; public final Map<String, ElementValue> elementValues;
public AnnotationAttribute(String type, Map<String, ElementValue> elementValues) { public AnnotationAttribute(String type, Map<String, ElementValue> elementValues) {