Annotation Interface ConcordionScoped


@Target({TYPE,FIELD}) @Retention(RUNTIME) public @interface ConcordionScoped
For fields that are expensive to setup, this annotation specifies the scope of the field. For example, a field marked with @ConcordionScoped(Scope.SPECIFICATION), would be constructed once per specification.

Without this annotation, instance fields are reinitialised for every example (that uses the example command).

This annotation can only be used with fields of type ScopedObjectHolder.

Example:

 @ConcordionScoped(Scope.SPECIFICATION)
 private ScopedObjectHolder<Browser> browserHolder = new ScopedObjectHolder<Browser>() {
     @Override
     protected Browser create() {
         return new Browser();
     }
     
     @Override
     protected void destroy(Browser browser) {
         browser.close();
     };
 };
 
Since:
2.0.0
  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
     
  • Element Details