|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcetus.hir.Declaration
cetus.hir.PreAnnotation
public class PreAnnotation
Represents a text annotation (comment or pragma) or a list of keyed values. Internally, an annotation is a single string or a map of keys to values. There is no restriction on the type or content of the keys and values. Compiler passes are free to use annotations as they see fit, although annotations used by multiple passes should be well-documented. By default, annotations are printed as a multi-line comment. They can also be printed as pragmas. If the text value of the annotation has been set, the text is printed, otherwise the list of keyed values is printed.
| Field Summary | |
|---|---|
protected java.util.HashMap |
map
|
static java.lang.reflect.Method |
print_as_comment_method
Useful for passing to setPrintMethod or setClassPrintMethod. |
static java.lang.reflect.Method |
print_as_pragma_method
Useful for passing to setPrintMethod or setClassPrintMethod. |
static java.lang.reflect.Method |
print_raw_method
Useful for passing to setPrintMethod or setClassPrintMethod. |
protected java.lang.String |
text
|
| Fields inherited from class cetus.hir.Declaration |
|---|
annotations, children, object_print_method, parent, print_as_statement_method |
| Constructor Summary | |
|---|---|
PreAnnotation()
Creates an empty annotation. |
|
PreAnnotation(java.lang.String text)
Creates a text annotation. |
|
| Method Summary | |
|---|---|
void |
add(java.lang.Object key,
java.lang.Object value)
|
static void |
defaultPrint(PreAnnotation note,
java.io.OutputStream stream)
Prints an annotation to a stream. |
boolean |
equals(java.lang.Object o)
|
java.util.List |
getDeclaredSymbols()
Returns a list of IDExpressions that are the symbols introduced by this declaration. |
java.util.Map |
getMap()
Provides access to the annotation map. |
java.lang.String |
getText()
|
int |
hashCode()
|
static void |
printAsComment(PreAnnotation note,
java.io.OutputStream stream)
Prints an annotation as a multi-line comment. |
static void |
printAsPragma(PreAnnotation note,
java.io.OutputStream stream)
Prints an annotation as a single-line pragma. |
static void |
printRaw(PreAnnotation note,
java.io.OutputStream stream)
Prints an annotation's contents without enclosing them in comments. |
void |
setChild(int index,
Traversable t)
Unsupported - this object has no children. |
static void |
setClassPrintMethod(java.lang.reflect.Method m)
Overrides the class print method, so that all subsequently created objects will use the supplied method. |
void |
setText(java.lang.String text)
Sets the text of the annotation. |
java.lang.String |
toString()
Returns a string for this annotation following the object print method. |
| Methods inherited from class cetus.hir.Declaration |
|---|
annotate, annotateAfter, annotateBefore, annotationToString, clone, containsAnnotation, detach, getAnnotation, getAnnotations, getAnnotations, getAnnotations, getChildren, getParent, print, printAsStatement, removeAnnotations, removeAnnotations, removeChild, setParent, setPrintMethod, toAnnotatedString, verify |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.reflect.Method print_as_comment_method
public static final java.lang.reflect.Method print_as_pragma_method
public static final java.lang.reflect.Method print_raw_method
protected java.util.HashMap map
protected java.lang.String text
| Constructor Detail |
|---|
public PreAnnotation()
public PreAnnotation(java.lang.String text)
text - The text to be used as a comment or pragma.| Method Detail |
|---|
public void add(java.lang.Object key,
java.lang.Object value)
public static void defaultPrint(PreAnnotation note,
java.io.OutputStream stream)
note - The annotation to print.stream - The stream on which to print the annotation.public boolean equals(java.lang.Object o)
equals in class java.lang.Objectpublic java.util.List getDeclaredSymbols()
Declaration
getDeclaredSymbols in class Declarationpublic java.util.Map getMap()
public java.lang.String getText()
public int hashCode()
hashCode in class java.lang.Object
public static void printAsComment(PreAnnotation note,
java.io.OutputStream stream)
note - The annotation to print.stream - The stream on which to print the annotation.
public static void printAsPragma(PreAnnotation note,
java.io.OutputStream stream)
note - The annotation to print.stream - The stream on which to print the annotation.
public static void printRaw(PreAnnotation note,
java.io.OutputStream stream)
note - The annotation to print.stream - The stream on which to print the annotation.public java.lang.String toString()
toString in class Declaration
public void setChild(int index,
Traversable t)
setChild in interface TraversablesetChild in class Declarationpublic static void setClassPrintMethod(java.lang.reflect.Method m)
m - The new print method.public void setText(java.lang.String text)
text - The text to be used as a comment or pragma.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||