Author: kylem
Date: Thu Apr 28 15:33:22 2005
New Revision: 165217
URL: http://svn.apache.org/viewcvs?rev=165217&view=rev
Log:
Modified error checking so AptControlInterface could be used to model
contextual services, even if they are classes and not interfaces. Resolves
BEEHIVE-364
Modified:
incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptControlInterface.java
Modified:
incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptControlInterface.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptControlInterface.java?rev=165217&r1=165216&r2=165217&view=diff
==============================================================================
---
incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptControlInterface.java
(original)
+++
incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptControlInterface.java
Thu Apr 28 15:33:22 2005
@@ -49,7 +49,8 @@
/**
* The AptControlInterface provides validation and metadata management for a
ControlInterface
- * or ControlExtension class during APT processing.
+ * or ControlExtension class during APT processing. It is also used to model
the interface
+ * to contextual services, since they parallel the conventions of control
interfaces.
*/
public class AptControlInterface extends AptType implements Generator
{
@@ -62,7 +63,18 @@
public AptControlInterface(Declaration decl,
AnnotationProcessorEnvironment env)
{
_env = env;
- if (! (decl instanceof InterfaceDeclaration))
+
+ //
+ // Verify that the @ControlInterface/@ControlExtension annotations are
only used on an
+ // interface.
+ // Note: AptControlInterface is also used to construct the operation
and event model
+ // for contextual services (see AptContextField). Becaue contextual
sevices can actually
+ // be classes as well as interfaces, the test below has to be specific
to the annotated
+ // use cases
+ //
+ if (! (decl instanceof InterfaceDeclaration) &&
+ (decl.getAnnotation(ControlExtension.class) != null ||
+ decl.getAnnotation(ControlInterface.class) != null))
{
env.getMessager().printError(decl.getPosition(),
"The ControlInterface or ControlExtension annotation may only be
used on a Java interface");