|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.cmu.cs.crystal.annotations.AnnotationDatabase
public class AnnotationDatabase
This class is a database for annotations. It can store annotations of methods we have analyzed or of ones we have not. Either way, it does not store any AST information, so it returns Crystal objects that represent an annotation. Those who want to use this database must register the type of annotations to scan for, @see{ICrystalAnnotation}. A ICrystalAnnotation provides all the information that one needs about the annotations. An AnnotationSummary is particularly useful for finding all information relating to the method, including parameters. And just in case you were wondering...we can not use regular reflection objects here (Class, Annotation, etc.) as the files we are analyzing aren't on the classpath of the system we are running. The annotation database currently allows clients to request annotations if they provide an ITypeBinding. However, this means that Crystal needs to have parsed and analyzed the code in question to get an ITypeBinding in the first place. Instead, we would like to retrieve annotations from unanalyzed code (for example, a library). This can currently be done with @link{#getAnnosForType(IType)}, and the plan is to eventually allow methods and fields based upon the Java Model instead of the Java ASTNodes.
Constructor Summary | |
---|---|
AnnotationDatabase()
|
Method Summary | ||
---|---|---|
void |
addAnnotationToField(ICrystalAnnotation anno,
FieldDeclaration field)
|
|
void |
addAnnotationToMethod(AnnotationSummary anno,
MethodDeclaration method)
|
|
void |
addAnnotationToType(ICrystalAnnotation anno,
TypeDeclaration type)
|
|
ICrystalAnnotation |
createCrystalAnnotation(IType typeOfAnnotation)
See createCrystalAnnotation(ITypeBinding) . |
|
ICrystalAnnotation |
createCrystalAnnotation(ITypeBinding typeBinding)
|
|
static
|
filter(List<ICrystalAnnotation> list,
Class<A> type)
|
|
List<ICrystalAnnotation> |
getAnnosForType(IType type)
This method will return the list of annotations associated with the given type. |
|
List<ICrystalAnnotation> |
getAnnosForType(ITypeBinding type)
This method will return the list of annotations associated with the given type. |
|
List<ICrystalAnnotation> |
getAnnosForVariable(IVariableBinding binding)
This method will return the list of annotations associated with the given variable. |
|
AnnotationSummary |
getSummaryForMethod(IMethodBinding binding)
Given a method binding, returns a summary that represents annotation info for that method declaration. |
|
boolean |
isMulti(IAnnotationBinding annoBinding)
Checks whether this annotation is marked as a multi annotation, as described by MultiAnnotation |
|
boolean |
isMulti(IAnnotation anno,
IType relative_type)
See isMulti(IAnnotationBinding) . |
|
void |
register(String fullyQualifiedName,
Class<? extends ICrystalAnnotation> crystalAnnotationClass,
boolean isMeta)
|
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AnnotationDatabase()
Method Detail |
---|
public void register(String fullyQualifiedName, Class<? extends ICrystalAnnotation> crystalAnnotationClass, boolean isMeta)
public AnnotationSummary getSummaryForMethod(IMethodBinding binding)
public List<ICrystalAnnotation> getAnnosForType(IType type) throws JavaModelException
getAnnosForType(ITypeBinding)
except that it works on the
Java model element, so it does not require the type to have been parsed
and analyzed by Crystal.
JavaModelException
public List<ICrystalAnnotation> getAnnosForType(ITypeBinding type)
getAnnosForType(IType)
.
public List<ICrystalAnnotation> getAnnosForVariable(IVariableBinding binding)
public boolean isMulti(IAnnotationBinding annoBinding)
annoBinding
-
public boolean isMulti(IAnnotation anno, IType relative_type) throws JavaModelException
isMulti(IAnnotationBinding)
.
JavaModelException
public ICrystalAnnotation createCrystalAnnotation(IType typeOfAnnotation) throws JavaModelException
createCrystalAnnotation(ITypeBinding)
.
JavaModelException
public ICrystalAnnotation createCrystalAnnotation(ITypeBinding typeBinding)
public void addAnnotationToField(ICrystalAnnotation anno, FieldDeclaration field)
public void addAnnotationToMethod(AnnotationSummary anno, MethodDeclaration method)
public void addAnnotationToType(ICrystalAnnotation anno, TypeDeclaration type)
public static <A extends ICrystalAnnotation> List<A> filter(List<ICrystalAnnotation> list, Class<A> type)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |