net.sf.daileon.notsupported
Class EquivalentAnnotationsCollector

java.lang.Object
  extended by org.objectweb.asm.ClassAdapter
      extended by net.sf.daileon.notsupported.AbstractTemplateAnnotationsCollector
          extended by net.sf.daileon.notsupported.EquivalentAnnotationsCollector
All Implemented Interfaces:
org.objectweb.asm.ClassVisitor

 class EquivalentAnnotationsCollector
extends AbstractTemplateAnnotationsCollector

The EquivalentAnnotationsCollector is responsible for collecting the annotations of the elements indicated in the template classes, which are the elements that keep annotations that correspond to domain annotations. It reads annotations of classes, fields or methods, according to the element indicated in a particular template annotation.

Version:
1.0 01/01/2010
Author:
Roberto Perillo
See Also:
ClassTemplate, FieldTemplate, MethodTemplate

Field Summary
private  boolean classAnnotations
          Informs whether the annotations that correspond to a domain annotation are at class level
private  boolean elementVisited
          Controls the visiting of the element indicated in the template annotation
private  String fieldName
          The field name to be read, as indicated in a FieldTemplate annotation
private  String methodName
          The method name to be read, as indicated in a MethodTemplate annotation
 
Fields inherited from class org.objectweb.asm.ClassAdapter
cv
 
Constructor Summary
EquivalentAnnotationsCollector(org.objectweb.asm.ClassVisitor classVisitor)
          Class constructor.
 
Method Summary
(package private)  String getFieldName()
          Gets the field name to be visited.
(package private)  String getMethodName()
          Gets the method name to be visited.
(package private)  boolean isClassAnnotations()
          Informs whether the annotations are at class level.
(package private)  boolean isElementVisited()
          Informs whether the element that keeps the annotations that correspond to a particular domain annotation has already been visited.
(package private)  void setClassAnnotations(boolean classAnnotations)
          Defines whether the annotations that correspond to a particular domain annotation are at class level.
(package private)  void setFieldName(String fieldName)
          Sets the field name to be visited.
(package private)  void setMethodName(String methodName)
          Sets the method name to be visited.
 void visitAttribute(org.objectweb.asm.Attribute attribute)
          Collects the annotations of a particular class at class level.
 void visitField(int access, String name, String desc, Object value, org.objectweb.asm.Attribute attribute)
          Collects the annotations of a particular particular field, which is indicated via the setFieldName(String) method.
 org.objectweb.asm.CodeVisitor visitMethod(int access, String name, String desc, String[] exceptions, org.objectweb.asm.Attribute attribute)
          Collects the annotations of a particular method, which is indicated via the setMethodName(String) method.
 
Methods inherited from class net.sf.daileon.notsupported.AbstractTemplateAnnotationsCollector
collectAnnotations, getAnnotations, setAnnotations
 
Methods inherited from class org.objectweb.asm.ClassAdapter
visit, visitEnd, visitInnerClass
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

fieldName

private String fieldName
The field name to be read, as indicated in a FieldTemplate annotation


methodName

private String methodName
The method name to be read, as indicated in a MethodTemplate annotation


classAnnotations

private boolean classAnnotations
Informs whether the annotations that correspond to a domain annotation are at class level


elementVisited

private boolean elementVisited
Controls the visiting of the element indicated in the template annotation

Constructor Detail

EquivalentAnnotationsCollector

EquivalentAnnotationsCollector(org.objectweb.asm.ClassVisitor classVisitor)
Class constructor.

Parameters:
classVisitor - The ClassVisitor object that visits the class.
Method Detail

getFieldName

String getFieldName()
Gets the field name to be visited. This field keeps the annotations that are indicated in a particular FieldTemplate annotation.

Returns:
The field name.

setFieldName

void setFieldName(String fieldName)
Sets the field name to be visited. This field keeps the annotations that are indicated in a particular FieldTemplate annotation.

Parameters:
fieldName - The field name.

getMethodName

String getMethodName()
Gets the method name to be visited. This method keeps the annotations that are indicated in a particular MethodTemplate annotation.

Returns:
The method name.

setMethodName

void setMethodName(String methodName)
Sets the method name to be visited. This method keeps the annotations that are indicated in a particular MethodTemplate annotation.

Parameters:
methodName - The method name.

isClassAnnotations

boolean isClassAnnotations()
Informs whether the annotations are at class level.

Returns:
A boolean value that can be:
  • true if the annotations indicated by a template annotation are at class level;
  • false if the annotations indicated are not at class level.

setClassAnnotations

void setClassAnnotations(boolean classAnnotations)
Defines whether the annotations that correspond to a particular domain annotation are at class level.

Parameters:
classAnnotations - A boolean value that can be:
  • true if the annotations to be evaluated are at class level;
  • false if the annotations to be evaluated are not at class level.

isElementVisited

boolean isElementVisited()
Informs whether the element that keeps the annotations that correspond to a particular domain annotation has already been visited.

Returns:
A boolean value that can be:
  • true if the element has already been analyzed;
  • false if the element has not been analyzed.

visitAttribute

public void visitAttribute(org.objectweb.asm.Attribute attribute)
Collects the annotations of a particular class at class level.

Specified by:
visitAttribute in interface org.objectweb.asm.ClassVisitor
Overrides:
visitAttribute in class org.objectweb.asm.ClassAdapter

visitField

public void visitField(int access,
                       String name,
                       String desc,
                       Object value,
                       org.objectweb.asm.Attribute attribute)
Collects the annotations of a particular particular field, which is indicated via the setFieldName(String) method.

Specified by:
visitField in interface org.objectweb.asm.ClassVisitor
Overrides:
visitField in class org.objectweb.asm.ClassAdapter

visitMethod

public org.objectweb.asm.CodeVisitor visitMethod(int access,
                                                 String name,
                                                 String desc,
                                                 String[] exceptions,
                                                 org.objectweb.asm.Attribute attribute)
Collects the annotations of a particular method, which is indicated via the setMethodName(String) method.

Specified by:
visitMethod in interface org.objectweb.asm.ClassVisitor
Overrides:
visitMethod in class org.objectweb.asm.ClassAdapter