net.sf.daileon.notsupported
Class RuntimeAnnotationsHelper

java.lang.Object
  extended by net.sf.daileon.notsupported.RuntimeAnnotationsHelper

 class RuntimeAnnotationsHelper
extends Object

The RuntimeAnnotationsHelper class provides several static methods for dealing with annotations. This class is useful for the default approach of keeping the annotations that correspond to each domain annotation in elements indicated in template annotations.

Version:
1.0 01/01/2010
Author:
Roberto Perillo

Field Summary
private static String CLASS_TEMPLATE
          The fully-qualified name of the ClassTemplate annotation
private static String FIELD_TEMPLATE
          The fully-qualified name of the FieldTemplate annotation
private static String METHOD_TEMPLATE
          The fully-qualified name of the MethodTemplate annotation
 
Constructor Summary
private RuntimeAnnotationsHelper()
          Class constructor.
 
Method Summary
(package private) static String getAnnotationName(String annotation)
          Gets the name (in the format package.name) of a particular annotation.
(package private) static String getClassPath(String path, String className)
          Gets the physical path of a given class.
(package private) static String getResourcePath(String path, org.objectweb.asm.attrs.Annotation annotation)
          Gets the physical path of a given annotation.
(package private) static boolean isDomainAnnotation(String path, org.objectweb.asm.attrs.Annotation annotation)
          Informs whether a given annotation is a domain annotation.
(package private) static boolean isTemplateAnnotation(org.objectweb.asm.attrs.Annotation collectedAnnotation)
          Verifies if an annotation is a template annotation, that is, if it is a ClassTemplate, FieldTemplate or MethodTemplate annotation.
(package private) static org.objectweb.asm.attrs.RuntimeVisibleAnnotations retrieveAnnotations(String path, org.objectweb.asm.attrs.Annotation annotation)
          Retrieves the annotations that correspond to a domain annotation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLASS_TEMPLATE

private static final String CLASS_TEMPLATE
The fully-qualified name of the ClassTemplate annotation

See Also:
Constant Field Values

METHOD_TEMPLATE

private static final String METHOD_TEMPLATE
The fully-qualified name of the MethodTemplate annotation

See Also:
Constant Field Values

FIELD_TEMPLATE

private static final String FIELD_TEMPLATE
The fully-qualified name of the FieldTemplate annotation

See Also:
Constant Field Values
Constructor Detail

RuntimeAnnotationsHelper

private RuntimeAnnotationsHelper()
Class constructor.

Method Detail

isDomainAnnotation

static boolean isDomainAnnotation(String path,
                                  org.objectweb.asm.attrs.Annotation annotation)
Informs whether a given annotation is a domain annotation.

Parameters:
path - The path to the annotation.
annotation - The annotation to be verified.
Returns:
A boolean value that can be:
  • true if the given annotation is a domain annotation;
  • false if the given annotation is not a domain annotation.

getAnnotationName

static String getAnnotationName(String annotation)
Gets the name (in the format package.name) of a particular annotation.

Parameters:
annotation - The name of the annotation.
Returns:
The name of the annotation, in the format package.name.

retrieveAnnotations

static org.objectweb.asm.attrs.RuntimeVisibleAnnotations retrieveAnnotations(String path,
                                                                             org.objectweb.asm.attrs.Annotation annotation)
                                                                      throws DuplicateAnnotationException
Retrieves the annotations that correspond to a domain annotation. Essentially, it reads the domain annotation, reads the elements indicated in it and collects the annotations that annotate them.

Parameters:
path - The path to the domain annotation to be evaluated.
annotation - The domain annotation to be evaluated.
Returns:
The RuntimeVisibleAnnotations, containing the annotations that correspond to the domain annotation.
Throws:
DuplicateAnnotationException - If the domain annotation evaluates to an annotation that already annotates the element, or if a domain annotation annotates another domain annotation, and both of them evaluate to the same annotation.

isTemplateAnnotation

static boolean isTemplateAnnotation(org.objectweb.asm.attrs.Annotation collectedAnnotation)
Verifies if an annotation is a template annotation, that is, if it is a ClassTemplate, FieldTemplate or MethodTemplate annotation.

Parameters:
collectedAnnotation - The annotation to be verified.
Returns:
A boolean value that can be:
  • true if the given annotation is a template annotation;
  • false if the given annotation is not a template annotation.

getResourcePath

static String getResourcePath(String path,
                              org.objectweb.asm.attrs.Annotation annotation)
Gets the physical path of a given annotation.

Parameters:
path - The path to the annotation.
annotation - The annotation itself.
Returns:
The complete physical path to the annotation.

getClassPath

static String getClassPath(String path,
                           String className)
Gets the physical path of a given class.

Parameters:
path - The path to the annotation.
className - The fully-qualified name of the class.
Returns:
The complete physical path to the class.