- All Superinterfaces:
Prototype.Api
- All Known Implementing Classes:
Lookup.BuilderBase.LookupImpl
Lookup criteria to discover services, mostly used when interacting with a service registry.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic class
Fluent API builder forLookup
.static class
Lookup.BuilderBase<BUILDER extends Lookup.BuilderBase<BUILDER,
PROTOTYPE>, PROTOTYPE extends Lookup> Fluent API builder base forLookup
. -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic Lookup.Builder
builder()
Create a new fluent API builder to customize configuration.static Lookup.Builder
Create a new fluent API builder from an existing instance.The managed services advertised types (i.e., typically its interfaces, can be throughService.ExternalContracts
).Optional
<GenericType<?>> A singleGenericType
can be defined if the lookup should also honorService.QualifiedFactory
services that can handle any type.static Lookup
Create service lookup from a contract type.static Lookup
create
(Dependency dependency) Create service lookup from this injection point information.static Lookup
Create service lookup from a contract type.Optionally, the injection point search applies to.If configured, the lookup will return service factories of the chosen types.boolean
Whether to include abstract type service descriptors.default boolean
Determines whether this lookup matches the criteria for injection.default boolean
matches
(ServiceInfo serviceInfo) Determines whether this service info criteria matches the service descriptor.default boolean
matchesContracts
(Lookup criteria) Determines whether the provided criteria match just the contracts portion of the provided criteria.default boolean
matchesQualifiers
(Set<Qualifier> qualifiers) Determines whether the provided qualifiers are matched by this lookup criteria.The managed service assigned Qualifier's.runLevel()
The optionalService.RunLevel
ascribed to the service.scopes()
The managed service assigned Scope.The managed service implementation type name.weight()
Weight that was declared on the type itself.
-
Field Details
-
EMPTY
Empty lookup matches anything and everything except for abstract types.
-
-
Method Details
-
builder
Create a new fluent API builder to customize configuration.- Returns:
- a new builder
-
builder
Create 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
-
create
Create service lookup from this injection point information.- Parameters:
dependency
- injection point to create lookup for- Returns:
- lookup to match injection point
-
create
Create service lookup from a contract type.- Parameters:
contract
- a single contract to base the lookup on- Returns:
- lookup for matching services
-
create
Create service lookup from a contract type.- Parameters:
contract
- a single contract to base the lookup on- Returns:
- lookup for matching services
-
serviceType
The managed service implementation type name.- Returns:
- the service type name
-
scopes
The managed service assigned Scope. If empty, any scope is matched. If more than one value, any service in one of these scopes is matched.- Returns:
- the service scope type name
-
qualifiers
The managed service assigned Qualifier's.- Returns:
- the service qualifiers
-
contracts
Set<ResolvedType> contracts()The managed services advertised types (i.e., typically its interfaces, can be throughService.ExternalContracts
).- Returns:
- the service contracts implemented
-
contractType
Optional<GenericType<?>> contractType()A singleGenericType
can be defined if the lookup should also honorService.QualifiedFactory
services that can handle any type. This would be the target type to convert to. If not specified, Object will be used.- Returns:
- generic type of the contract, if only one contract is desired
-
runLevel
The optionalService.RunLevel
ascribed to the service.- Returns:
- the service's run level
-
weight
Weight that was declared on the type itself.- Returns:
- the declared weight
-
includeAbstract
boolean includeAbstract()Whether to include abstract type service descriptors.- Returns:
- whether to include abstract classes and interfaces
-
dependency
Optional<Dependency> dependency()Optionally, the injection point search applies to. There are some service factories (such asService.InjectionPointFactory
) that provide instances for a specific injection point. Such factories may require an injection point to be present, and may fail otherwise.Injection points of each service are generated as public constants on their respective service descriptors.
- Returns:
- the optional injection point context info
-
factoryTypes
Set<FactoryType> factoryTypes()If configured, the lookup will return service factories of the chosen types. If no factory types are defined, service instances are returned.Otherwise only service factories of the chosen types are returned, as follows:
FactoryType.SERVICE
- only services that directly implement the contractFactoryType.SUPPLIER
- only that areSupplier
of the contractFactoryType.QUALIFIED
- services that areService.QualifiedFactory
of the contractFactoryType.SERVICES
- services that areService.ServicesFactory
of the contractFactoryType.INJECTION_POINT
- services that areService.InjectionPointFactory
of the contractFactoryType.NONE
- this has no effect and will not modify the lookup
- Returns:
- desired factory types
-
matches
Determines whether this lookup matches the criteria for injection. Matches is a looser form of equality check thanequals()
. If a service matches criteria it is generally assumed to be viable for assignability.- Parameters:
criteria
- the criteria to compare against- Returns:
- true if the criteria provided matches this instance
-
matches
Determines whether this service info criteria matches the service descriptor. Matches is a looser form of equality check thanequals()
. If a service matches criteria it is generally assumed to be viable for assignability.- Parameters:
serviceInfo
- to compare with- Returns:
- true if this criteria matches the service descriptor
-
matchesContracts
Determines whether the provided criteria match just the contracts portion of the provided criteria. Note that it is expected any external contracts have been consolidated into the regular contract section.- Parameters:
criteria
- the criteria to compare against- Returns:
- true if the criteria provided matches this instance from only the contracts point of view
-
matchesQualifiers
Determines whether the provided qualifiers are matched by this lookup criteria.- Parameters:
qualifiers
- qualifiers of a service- Returns:
- whether this lookup matches those qualifiers
-