3 Replies Latest reply on Jul 10, 2006 3:42 PM by JBoss Fan

    How to use Annotation attributes that are variables

    JBoss Fan Newbie

      Hi there,

      When using Seam annotations I need to use annotation attributes that are not string constants.

      In this code fragment:

      @CreateProcess(definition="myProcessDefinition")
      @Begin(nested=true, pageflow="myPageFlowDefinition")
      public void startProcess() {
      ...
      }
      

      Is it possible to use variables instead of strings like: "myProcessDefinition".
      I've tried referencing a private variable but I get a compilation error:

      The value for annotation attribute CreateProcess.definition must be a constant expression

      I know that this annotation in particular could be implemented using jBPMs api method:
      public ProcessInstance newProcessInstance(java.lang.String processDefinitionName)

      But I would prefer to use annotations (cleaner, compact code).

      Is there an elegant workaround or do I just drop this annotation and call their corresponding api method.

      Thanks for all your possible suggestions.

      Yeyo