Author: scabanovich
Date: 2011-06-29 18:37:31 -0400 (Wed, 29 Jun 2011)
New Revision: 32472
Added:
trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/java/IAnnotated.java
trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/java/IAnnotationDeclaration.java
trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/java/IAnnotationType.java
Modified:
trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/java/ParametedType.java
Log:
JBIDE-5046
https://issues.jboss.org/browse/JBIDE-5046
Added:
trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/java/IAnnotated.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/java/IAnnotated.java
(rev 0)
+++
trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/java/IAnnotated.java 2011-06-29
22:37:31 UTC (rev 32472)
@@ -0,0 +1,63 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.common.java;
+
+import java.util.List;
+
+import org.jboss.tools.common.text.ITextSourceReference;
+
+/**
+ * Represents a model element that can be annotated.
+ *
+ * @author Alexey Kazakov
+ */
+public interface IAnnotated {
+
+ /**
+ * Get all annotations of the element.
+ *
+ * @return all annotations of the element, or an empty list if no
+ * annotations are present
+ */
+ List<IAnnotationDeclaration> getAnnotations();
+
+ /**
+ * Get element annotation of a certain annotation type.
+ *
+ * @param annotationTypeName
+ * the name of the annotation type
+ * @return the element annotation of the given annotation type, or a null
+ * value
+ */
+ IAnnotationDeclaration getAnnotation(String annotationTypeName);
+
+ /**
+ * This method is similar to getAnnotation(String annotationTypeName). But
+ * JDT doesn't have API for getting IAnnotation from method parameters so
+ * this method is preferable for method parameters.
+ *
+ * @param annotationTypeName
+ * the name of the annotation type
+ * @return the text source reference of the annotation of the given annotation type, or
a null
+ * value
+ */
+ ITextSourceReference getAnnotationPosition(String annotationTypeName);
+
+ /**
+ * Determine if the element has an annotation of a certain annotation type.
+ *
+ * @param annotationTypeName
+ * the annotation type to check for
+ * @return true if the element has an annotation of the given annotation
+ * type, or false otherwise
+ */
+ boolean isAnnotationPresent(String annotationTypeName);
+}
\ No newline at end of file
Property changes on:
trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/java/IAnnotated.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added:
trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/java/IAnnotationDeclaration.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/java/IAnnotationDeclaration.java
(rev 0)
+++
trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/java/IAnnotationDeclaration.java 2011-06-29
22:37:31 UTC (rev 32472)
@@ -0,0 +1,83 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.common.java;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jdt.core.IMember;
+import org.eclipse.jdt.core.IMemberValuePair;
+import org.eclipse.jdt.core.IType;
+import org.jboss.tools.common.text.ITextSourceReference;
+
+/**
+ * Represents an annotation declaration. For example, in CDI, a qualifier or a scope
+ * declaration of a bean/injection/produce method.
+ *
+ * @author Alexey Kazakov
+ */
+public interface IAnnotationDeclaration extends ITextSourceReference {
+
+ /**
+ * Returns the member value pairs.
+ *
+ * @return the member value pairs
+ */
+ IMemberValuePair[] getMemberValuePairs();
+
+ /**
+ * Convenience method that allows to get one member value without enumerating pairs.
+ * @param name
+ * @return
+ */
+ Object getMemberValue(String name);
+
+ /**
+ * Returns the member which is annotated by this declaration.
+ *
+ * @return the member which is annotated by this declaration
+ */
+ IMember getParentMember();
+
+ /**
+ * Returns the corresponding type name of the annotation.
+ *
+ * @return the corresponding type name of the annotation
+ */
+ String getTypeName();
+
+ /**
+ * Returns the corresponding IType of the annotation. May be null.
+ *
+ * @return the corresponding IType of the annotation
+ */
+ IType getType();
+
+ /**
+ * Returns the corresponding annotation. May be null.
+ *
+ * @return the corresponding annotation
+ */
+ IAnnotationType getAnnotation();
+
+ /**
+ * Returns underlying Java annotation if this declaration is based on Java source.
+ * Returns null if this declaration is based on xml source.
+ *
+ * @return underlying Java annotation if it exists
+ */
+ IAnnotation getJavaAnnotation();
+
+ /**
+ * Returns resource which contains this declaration
+ * @return
+ */
+ IResource getResource();
+}
\ No newline at end of file
Property changes on:
trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/java/IAnnotationDeclaration.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added:
trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/java/IAnnotationType.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/java/IAnnotationType.java
(rev 0)
+++
trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/java/IAnnotationType.java 2011-06-29
22:37:31 UTC (rev 32472)
@@ -0,0 +1,41 @@
+package org.jboss.tools.common.java;
+
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.jdt.core.IMethod;
+import org.eclipse.jdt.core.IType;
+
+/**
+ * Common interface for an annotation interface.
+ *
+ * @author Viacheslav Kabanovich
+ *
+ */
+public interface IAnnotationType {
+
+ /**
+ * Returns the corresponding IType of the annotation type.
+ *
+ * @return the corresponding IType
+ */
+ IType getSourceType();
+
+ /**
+ * Returns all the available annotations which are declared for this
+ * interface.
+ *
+ * @return all the available annotations which are declared for this
+ * interface
+ */
+ List<IAnnotationDeclaration> getAnnotationDeclarations();
+
+ /**
+ * Returns the annotations with given type name.
+ *
+ * @param typeName
+ * @return the annotations with given type name
+ */
+ IAnnotationDeclaration getAnnotationDeclaration(String typeName);
+
+}
\ No newline at end of file
Property changes on:
trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/java/IAnnotationType.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified:
trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/java/ParametedType.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/java/ParametedType.java 2011-06-29
22:29:41 UTC (rev 32471)
+++
trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/java/ParametedType.java 2011-06-29
22:37:31 UTC (rev 32472)
@@ -56,7 +56,7 @@
/*
* (non-Javadoc)
- * @see org.jboss.tools.cdi.core.IParametedType#isPrimitive()
+ * @see org.jboss.tools.common.java.IParametedType#isPrimitive()
*/
public boolean isPrimitive() {
return primitive;