- All Superinterfaces:
- Prototype.Api
- All Known Implementing Classes:
- Dependency.BuilderBase.DependencyImpl
Dependency metadata.
 
Dependencies can be injected into a service through a constructor. We also support field injection, though it is not recommended due to complicated unit testing.
- See Also:
- 
Nested Class SummaryNested ClassesModifier and TypeInterfaceDescriptionstatic classFluent API builder forDependency.static classDependency.BuilderBase<BUILDER extends Dependency.BuilderBase<BUILDER,PROTOTYPE>, PROTOTYPE extends Dependency> Fluent API builder base forDependency.
- 
Method SummaryModifier and TypeMethodDescriptionaccess()The access modifier on the injection point/receiver.The annotations on this element, excludingqualifiers().static Dependency.Builderbuilder()Create a new fluent API builder to customize configuration.static Dependency.Builderbuilder(Dependency instance) Create a new fluent API builder from an existing instance.Cardinality of this dependency.contract()Each dependency ia a specific contract.GenericType<?> Generic type equivalent tocontract().static Dependencycreate()Create a new instance with default values.Descriptor declaring this dependency.Field name that declares this dependency in thedescriptor().Kind of element we inject into (constructor, field, method).booleanWhether this dependency usesServiceInstance.booleanWhether this dependency uses aSupplierinstead of a direct instance.method()Top level method that declares this method.name()Name of the constructor parameter.The qualifier type annotations on this element.service()Type name of the service that uses this dependency.typeName()Type of the dependency (exact parameter type with all generics).
- 
Method Details- 
builderCreate a new fluent API builder to customize configuration.- Returns:
- a new builder
 
- 
builderCreate a new fluent API builder from an existing instance.- Parameters:
- instance- an existing instance used as a base for the builder
- Returns:
- a builder based on an instance
 
- 
createCreate a new instance with default values.- Returns:
- a new instance
 
- 
serviceTypeName service()Type name of the service that uses this dependency.- Returns:
- the service declaring this dependency
 
- 
nameString name()Name of the constructor parameter.- Returns:
- unique name of the parameter
 
- 
contractTypeName contract()Each dependency ia a specific contract. Each service provides one or more contracts for dependencies. For example forList<MyService>, the contract isMyService.- Returns:
- contract of the service we depend on
 
- 
contractTypeGenericType<?> contractType()Generic type equivalent tocontract(). We need both, to prevent reflection at runtime.- Returns:
- generic type of the dependency
 
- 
descriptorTypeName descriptor()Descriptor declaring this dependency. Descriptor is always public.- Returns:
- descriptor
 
- 
descriptorConstantString descriptorConstant()Field name that declares this dependency in thedescriptor(). Can be used for code generation. This field is always a public constant.- Returns:
- field that has the dependency on the descriptor type
 
- 
typeNameTypeName typeName()Type of the dependency (exact parameter type with all generics).- Returns:
- type of the dependency as TypeName
 
- 
elementKindElementKind elementKind()Kind of element we inject into (constructor, field, method).- Returns:
- element kind (for parameters, the containing element)
 
- 
qualifiersThe qualifier type annotations on this element.- Returns:
- the qualifier type annotations on this element
 
- 
accessAccessModifier access()The access modifier on the injection point/receiver. Defaults toAccessModifier.PACKAGE_PRIVATE.- Returns:
- the access
 
- 
annotationsSet<Annotation> annotations()The annotations on this element, excludingqualifiers().- Returns:
- the annotations on this element
 
- 
methodTop level method that declares this method. This is to provide information about overridden methods, as we should only inject such methods once.- Returns:
- unique identification of a declaring method
 
- 
cardinalityDependencyCardinality cardinality()Cardinality of this dependency. Defaults toDependencyCardinality.REQUIRED.- Returns:
- cardinality of this dependency
 
- 
isServiceInstanceboolean isServiceInstance()Whether this dependency usesServiceInstance. Defaults tofalse, which means the service is injected via its contract.- Returns:
- whether the dependency is declared as a ServiceInstance
 
- 
isSupplierboolean isSupplier()Whether this dependency uses aSupplierinstead of a direct instance. This defaults tofalse.- Returns:
- whether the dependency injection point uses a supplier
 
 
-