Module io.helidon.service.registry
Package io.helidon.service.registry
Class Dependency.BuilderBase<BUILDER extends Dependency.BuilderBase<BUILDER,PROTOTYPE>,PROTOTYPE extends Dependency>
java.lang.Object
io.helidon.service.registry.Dependency.BuilderBase<BUILDER,PROTOTYPE>
- Type Parameters:
BUILDER
- type of the builder extending this abstract builderPROTOTYPE
- type of the prototype interface that would be built byPrototype.Builder.buildPrototype()
- All Implemented Interfaces:
Prototype.Builder<BUILDER,
PROTOTYPE>
- Direct Known Subclasses:
Dependency.Builder
- Enclosing interface:
Dependency
public abstract static class Dependency.BuilderBase<BUILDER extends Dependency.BuilderBase<BUILDER,PROTOTYPE>,PROTOTYPE extends Dependency>
extends Object
implements Prototype.Builder<BUILDER,PROTOTYPE>
Fluent API builder base for
Dependency
.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static class
Generated implementation of the prototype, can be extended by descendant prototype implementations. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaccess()
The access modifier on the injection point/receiver.access
(AccessModifier access) The access modifier on the injection point/receiver.addAnnotation
(Annotation annotation) The annotations on this element.addAnnotation
(Consumer<Annotation.Builder> consumer) The annotations on this element.addAnnotations
(Set<? extends Annotation> annotations) The annotations on this element.addQualifier
(Qualifier qualifier) The qualifier type annotations on this element.addQualifier
(Consumer<Qualifier.Builder> consumer) The qualifier type annotations on this element.addQualifiers
(Set<? extends Qualifier> qualifiers) The qualifier type annotations on this element.The annotations on this element.annotations
(Set<? extends Annotation> annotations) The annotations on this element.Cardinality of this dependency.cardinality
(DependencyCardinality cardinality) Cardinality of this dependency.Clear existing value of this property.contract()
Each dependency ia a specific contract.Each dependency ia a specific contract.contract
(Consumer<TypeName.Builder> consumer) Each dependency ia a specific contract.Each dependency ia a specific contract.GenericType
<?> Generic type equivalent toDependencyBlueprint.contract()
.contractType
(GenericType<?> contractType) Generic type equivalent toDependencyBlueprint.contract()
.Descriptor declaring this dependency.descriptor
(TypeName descriptor) Descriptor declaring this dependency.descriptor
(Consumer<TypeName.Builder> consumer) Descriptor declaring this dependency.descriptor
(Supplier<? extends TypeName> supplier) Descriptor declaring this dependency.Field name that declares this dependency in theDependencyBlueprint.descriptor()
.descriptorConstant
(String descriptorConstant) Field name that declares this dependency in theDependencyBlueprint.descriptor()
.Kind of element we inject into (constructor, field, method).elementKind
(ElementKind elementKind) Kind of element we inject into (constructor, field, method).from
(Dependency prototype) Update this builder from an existing prototype instance.from
(Dependency.BuilderBase<?, ?> builder) Update this builder from an existing prototype builder instance.boolean
Whether this dependency usesServiceInstance
.isServiceInstance
(boolean isServiceInstance) Whether this dependency usesServiceInstance
.boolean
Whether this dependency uses aSupplier
instead of a direct instance.isSupplier
(boolean isSupplier) Whether this dependency uses aSupplier
instead of a direct instance.method()
Top level method that declares this method.Top level method that declares this method.name()
Name of the constructor parameter.Name of the constructor parameter.protected void
Handles providers and decorators.The qualifier type annotations on this element.qualifiers
(Set<? extends Qualifier> qualifiers) The qualifier type annotations on this element.service()
Type name of the service that uses this dependency.Type name of the service that uses this dependency.service
(Consumer<TypeName.Builder> consumer) Type name of the service that uses this dependency.Type name of the service that uses this dependency.toString()
typeName()
Type of the dependency (exact parameter type with all generics).Type of the dependency (exact parameter type with all generics).typeName
(Consumer<TypeName.Builder> consumer) Type of the dependency (exact parameter type with all generics).Type of the dependency (exact parameter type with all generics).protected void
Validates required properties.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface io.helidon.builder.api.Prototype.Builder
buildPrototype, self
-
Constructor Details
-
BuilderBase
protected BuilderBase()Protected to support extensibility.
-
-
Method Details
-
from
Update this builder from an existing prototype instance. This method disables automatic service discovery.- Parameters:
prototype
- existing prototype to update this builder from- Returns:
- updated builder instance
-
from
Update this builder from an existing prototype builder instance.- Parameters:
builder
- existing builder prototype to update this builder from- Returns:
- updated builder instance
-
service
Type name of the service that uses this dependency.- Parameters:
service
- the service declaring this dependency- Returns:
- updated builder instance
- See Also:
-
service
Type name of the service that uses this dependency.- Parameters:
consumer
- consumer of builder for the service declaring this dependency- Returns:
- updated builder instance
- See Also:
-
service
Type name of the service that uses this dependency.- Parameters:
supplier
- supplier of the service declaring this dependency- Returns:
- updated builder instance
- See Also:
-
name
Name of the constructor parameter.- Parameters:
name
- unique name of the parameter- Returns:
- updated builder instance
- See Also:
-
contract
Each dependency ia a specific contract. Each service provides one or more contracts for dependencies. For example forList<MyService>
, the contract isMyService
.- Parameters:
contract
- contract of the service we depend on- Returns:
- updated builder instance
- See Also:
-
contract
Each dependency ia a specific contract. Each service provides one or more contracts for dependencies. For example forList<MyService>
, the contract isMyService
.- Parameters:
consumer
- consumer of builder for contract of the service we depend on- Returns:
- updated builder instance
- See Also:
-
contract
Each dependency ia a specific contract. Each service provides one or more contracts for dependencies. For example forList<MyService>
, the contract isMyService
.- Parameters:
supplier
- supplier of contract of the service we depend on- Returns:
- updated builder instance
- See Also:
-
contractType
Generic type equivalent toDependencyBlueprint.contract()
. We need both, to prevent reflection at runtime.- Parameters:
contractType
- generic type of the dependency- Returns:
- updated builder instance
- See Also:
-
descriptor
Descriptor declaring this dependency. Descriptor is always public.- Parameters:
descriptor
- descriptor- Returns:
- updated builder instance
- See Also:
-
descriptor
Descriptor declaring this dependency. Descriptor is always public.- Parameters:
consumer
- consumer of builder for descriptor- Returns:
- updated builder instance
- See Also:
-
descriptor
Descriptor declaring this dependency. Descriptor is always public.- Parameters:
supplier
- supplier of descriptor- Returns:
- updated builder instance
- See Also:
-
descriptorConstant
Field name that declares this dependency in theDependencyBlueprint.descriptor()
. Can be used for code generation. This field is always a public constant.- Parameters:
descriptorConstant
- field that has the dependency on the descriptor type- Returns:
- updated builder instance
- See Also:
-
typeName
Type of the dependency (exact parameter type with all generics).- Parameters:
typeName
- type of the dependency asTypeName
- Returns:
- updated builder instance
- See Also:
-
typeName
Type of the dependency (exact parameter type with all generics).- Parameters:
consumer
- consumer of builder for type of the dependency asTypeName
- Returns:
- updated builder instance
- See Also:
-
typeName
Type of the dependency (exact parameter type with all generics).- Parameters:
supplier
- supplier of type of the dependency asTypeName
- Returns:
- updated builder instance
- See Also:
-
elementKind
Kind of element we inject into (constructor, field, method).- Parameters:
elementKind
- element kind (for parameters, the containing element)- Returns:
- updated builder instance
- See Also:
-
qualifiers
The qualifier type annotations on this element.- Parameters:
qualifiers
- the qualifier type annotations on this element- Returns:
- updated builder instance
- See Also:
-
addQualifiers
The qualifier type annotations on this element.- Parameters:
qualifiers
- the qualifier type annotations on this element- Returns:
- updated builder instance
- See Also:
-
addQualifier
The qualifier type annotations on this element.- Parameters:
qualifier
- the qualifier type annotations on this element- Returns:
- updated builder instance
- See Also:
-
addQualifier
The qualifier type annotations on this element.- Parameters:
consumer
- the qualifier type annotations on this element- Returns:
- updated builder instance
- See Also:
-
access
The access modifier on the injection point/receiver. Defaults toAccessModifier.PACKAGE_PRIVATE
.- Parameters:
access
- the access- Returns:
- updated builder instance
- See Also:
-
annotations
The annotations on this element.- Parameters:
annotations
- the annotations on this element- Returns:
- updated builder instance
- See Also:
-
addAnnotations
The annotations on this element.- Parameters:
annotations
- the annotations on this element- Returns:
- updated builder instance
- See Also:
-
addAnnotation
The annotations on this element.- Parameters:
annotation
- the annotations on this element- Returns:
- updated builder instance
- See Also:
-
addAnnotation
The annotations on this element.- Parameters:
consumer
- the annotations on this element- Returns:
- updated builder instance
- See Also:
-
clearMethod
Clear existing value of this property.- Returns:
- updated builder instance
- See Also:
-
method
Top level method that declares this method. This is to provide information about overridden methods, as we should only inject such methods once.- Parameters:
method
- unique identification of a declaring method- Returns:
- updated builder instance
- See Also:
-
cardinality
Cardinality of this dependency. Defaults toDependencyCardinality.REQUIRED
.- Parameters:
cardinality
- cardinality of this dependency- Returns:
- updated builder instance
- See Also:
-
isServiceInstance
Whether this dependency usesServiceInstance
. Defaults tofalse
, which means the service is injected via its contract.- Parameters:
isServiceInstance
- whether the dependency is declared as aServiceInstance
- Returns:
- updated builder instance
- See Also:
-
isSupplier
Whether this dependency uses aSupplier
instead of a direct instance. This defaults tofalse
.- Parameters:
isSupplier
- whether the dependency injection point uses a supplier- Returns:
- updated builder instance
- See Also:
-
service
Type name of the service that uses this dependency.- Returns:
- the service
-
name
Name of the constructor parameter.- Returns:
- the name
-
contract
Each dependency ia a specific contract. Each service provides one or more contracts for dependencies. For example forList<MyService>
, the contract isMyService
.- Returns:
- the contract
-
contractType
Generic type equivalent toDependencyBlueprint.contract()
. We need both, to prevent reflection at runtime.- Returns:
- the contract type
-
descriptor
Descriptor declaring this dependency. Descriptor is always public.- Returns:
- the descriptor
-
descriptorConstant
Field name that declares this dependency in theDependencyBlueprint.descriptor()
. Can be used for code generation. This field is always a public constant.- Returns:
- the descriptor constant
-
typeName
Type of the dependency (exact parameter type with all generics).- Returns:
- the type name
-
elementKind
Kind of element we inject into (constructor, field, method).- Returns:
- the element kind
-
qualifiers
The qualifier type annotations on this element.- Returns:
- the qualifiers
-
access
The access modifier on the injection point/receiver. Defaults toAccessModifier.PACKAGE_PRIVATE
.- Returns:
- the access
-
annotations
The annotations on this element.- Returns:
- the annotations
-
method
Top level method that declares this method. This is to provide information about overridden methods, as we should only inject such methods once.- Returns:
- the method
-
cardinality
Cardinality of this dependency. Defaults toDependencyCardinality.REQUIRED
.- Returns:
- the cardinality
-
isServiceInstance
public boolean isServiceInstance()Whether this dependency usesServiceInstance
. Defaults tofalse
, which means the service is injected via its contract.- Returns:
- the is service instance
-
isSupplier
public boolean isSupplier()Whether this dependency uses aSupplier
instead of a direct instance. This defaults tofalse
.- Returns:
- the is supplier
-
toString
-
preBuildPrototype
protected void preBuildPrototype()Handles providers and decorators. -
validatePrototype
protected void validatePrototype()Validates required properties.
-