Top Description Inners Methods
org.glassfish.hk2.utilities

public @Interface Stub

extends Annotation
Annotations
@Documented
@Retention:SOURCE
@Target:TYPE
Static Imports
java.lang.annotation.ElementType.TYPE, .RetentionPolicy.SOURCE

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 org.jvnet.hk2.annotations.Service annotation

Any jakarta.inject.Named or org.jvnet.hk2.annotations.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 org.glassfish.hk2.api.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

Author
jwells

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static enum

Method Summary

Modifier and TypeMethod and Description
public Stub.Type

Returns:

The behavior of the generated methods
value
()

This value determines what the generated methods do

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

Inherited from java.lang.annotation.Annotation:
annotationTypeequalshashCodetoString

Method Detail

valueback to summary
public Stub.Type value()

This value determines what the generated methods do

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

If set to Type#EXCEPTIONS then the methods will throw UnsupportedOperationException

Returns:Stub.Type

The behavior of the generated methods

org.glassfish.hk2.utilities back to summary

public final Enum Stub.Type

extends Enum<Stub.Type>
Class Inheritance

Field Summary

Modifier and TypeField and Description
public static final Stub.Type
EXCEPTIONS

The generated methods of this stub will throw an UnsupportedOperationException

public static final Stub.Type
VALUES

The generated methods of this stub will return null and fixed values

Constructor Summary

AccessConstructor and Description
private
Type()

Method Summary

Modifier and TypeMethod and Description
public static Stub.Type
public static Stub.Type[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

EXCEPTIONSback to summary
public static final Stub.Type EXCEPTIONS

The generated methods of this stub will throw an UnsupportedOperationException

VALUESback to summary
public static final Stub.Type VALUES

The generated methods of this stub will return null and fixed values

Constructor Detail

Typeback to summary
private Type()

Method Detail

valueOfback to summary
public static Stub.Type valueOf(String name)
valuesback to summary
public static Stub.Type[] values()