Example usage for org.eclipse.jdt.internal.core Annotation Annotation

List of usage examples for org.eclipse.jdt.internal.core Annotation Annotation

Introduction

In this page you can find the example usage for org.eclipse.jdt.internal.core Annotation Annotation.

Prototype

public Annotation(JavaElement parent, String name) 

Source Link

Usage

From source file:pl.wroc.pwr.jbehaveplugin.editor.JavaAnalyzer.java

License:Open Source License

@SuppressWarnings("restriction")
public List<IMethod> getMethodsWithJBehaveAnnotations() throws JavaModelException {
    List<IMethod> methods = getMethods();
    List<IMethod> returnList = new ArrayList<IMethod>();
    for (IMethod method : methods) {
        String collectedAnnotationName = "";
        IAnnotation[] annotations = method.getAnnotations();
        for (IAnnotation annotation : annotations) {
            String annotationName = annotation.getElementName();
            if ("Given".equals(annotationName) || "When".equals(annotationName)
                    || "Then".equals(annotationName)) {
                returnList.add(method);//from  w w  w.  j  a v a 2  s  . c  o  m
                collectedAnnotationName = annotationName;
            }
            if ("Alias".equals(annotationName)) {
                @SuppressWarnings("unused")
                Annotation newFromAlias = new Annotation((JavaElement) annotation.getParent(),
                        collectedAnnotationName);
            }
        }
    }
    return returnList;
}