Annotation Type Stub


@Documented @Retention(SOURCE) @Target(TYPE) public @interface Stub
When this annotation is placed on an abstract class the methods of the class that are abstract will be generated into a subclass by the hk2-metadata-generator along with an empty Service annotation

Any Named or ContractsProvided annotation on the class marked with this annotation will also be copied to the implementation. No other qualifier or annotation will be copied to the concrete implementation. However, the Rank annotation on the stub class will be honored.

The methods generated into the subclass can either return null and fixed values (for scalars) or can throw exceptions, depending on the Stub.Type value of this annotation

Using this annotation is useful for testing, though it will work both with test code and non-test code

  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static enum 
     
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    This value determines what the generated methods do
  • Element Details

    • value

      Stub.Type value
      This value determines what the generated methods do

      If set to Stub.Type.VALUES then the methods will return nulls or fixed values for scalars.

      If set to Stub.Type.EXCEPTIONS then the methods will throw UnsupportedOperationException

      Returns:
      The behavior of the generated methods
      Default:
      VALUES