Kias
Kias

Reputation: 841

Inject value in to an annotation?

I would like to inject a value in to an annotation. Below I'm using an annotation for an Simple Workflow (SWF) class:

@Activities(version = "1.00")
@ActivityRegistrationOptions(defaultTaskList = FlowConstants.NO_DEFAULT_TASK_LIST)
public interface MyActivities {
    ...
}

Rather than use a constant, how do I inject a value to use for defaultTaskList?

Upvotes: 1

Views: 555

Answers (1)

alexbt
alexbt

Reputation: 17045

You can't specify anything else than a constant in an annotation.


However, I'm no SWF expert (far from it...), but I think the point of defaultTaskList is to provide the default value. The javadoc states that you may specify the list on activity invocation:

defaultTaskList: Task list that activity task is delivered through when no task list is specified on activity invocation.

Example from amazon (tasklist1):

AmazonSimpleWorkflow swfClient = new AmazonSimpleWorkflowClient(awsCredentials);
ActivityWorker worker = new ActivityWorker(swfClient,
                                           "domain1",
                                           "tasklist1");
worker.addActivitiesImplementation(new MyActivitiesImpl());

// Start worker
worker.start(); 

Upvotes: 1

Related Questions