de.upb.hni.vmagic
Class Annotations

java.lang.Object
  extended by de.upb.hni.vmagic.Annotations

public class Annotations
extends java.lang.Object

Utility class to retrieve and manipulate annotations. Annotations are object of arbitrary classes that can be added to an instance of a meta class. They can be used to add additional informations to a meta class instance. An example of using anotations is the vMAGIC VHDL parser that stores error information in the created meta class instances. Annotations are also used to store information about comments.


Method Summary
static
<T> T
getAnnotation(VhdlElement element, java.lang.Class<T> clazz)
          Returns an annotation instance of the given class.
static
<T> void
putAnnotation(VhdlElement element, java.lang.Class<T> clazz, T value)
          Stores an annotation in the given element.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getAnnotation

public static <T> T getAnnotation(VhdlElement element,
                                  java.lang.Class<T> clazz)
Returns an annotation instance of the given class. If no instance of the class is available in the element the function returns null.

Type Parameters:
T -
Parameters:
element - the element
clazz - the class of the instance
Returns:
the instance, or null

putAnnotation

public static <T> void putAnnotation(VhdlElement element,
                                     java.lang.Class<T> clazz,
                                     T value)
Stores an annotation in the given element. If an annotation of the same class existed before the call to this function it is replaced by the new instance.

Type Parameters:
T -
Parameters:
element - the element
clazz - the class of the instance
value - the instance