Most annotations work in validation time, in the sense that their implementations are invoked whenever some value is assigned to a property, or whenever the user requests a validation of the property.
However, there are occasions where an annotation may wish to "prepare the execution" of other annotations by carrying out some work that needs not be done independantly be other annotations. One such case, for example, are db-aware (database-aware) annotations. These annotations perform their work by accessing an external database. A db-aware annotation obviously needs to know how to connect to the database, but it would be very cumbersome to ask the user of the annotation to specify the connection parameters over and over again when usually these parameters remain the same for an application. It would be a better approach if these connection parameters were specified only once and had a "global effect" on all other annotations.
In cases like these, bind-time annotations can be used. A bind-time annotation is an annotation whose implementation is invoked when the shell is being built for a class. Since this process takes place only once per class, such an annotation is executed only once for the whole life of the application.
Usually, bind-time annotations will do some work, and will leave the result of their work in the class-wide envioronment of a shell.
An annotation wishing to be invoked during bind-time does two things:
public boolean onBind(Shell shell, Class clazz, DataStep step, String propertyName);
The annotation gets the shell that is being built for the class, the class, the data step and the property name (which may be null if the annotation is attached to a class or package)