Package oracle.dbtools.plugin.api.di
Class Instances.Builder
- java.lang.Object
-
- oracle.dbtools.plugin.api.di.Instances.Builder
-
- All Implemented Interfaces:
InstanceLocator
- Enclosing class:
- Instances
public static class Instances.Builder extends java.lang.Object implements InstanceLocator
BuildInstances
instances- Author:
- cdivilly
-
-
Field Summary
-
Fields inherited from interface oracle.dbtools.plugin.api.di.InstanceLocator
INSTANCE_LOCATOR_ATTRIBUTE, INSTANTIATOR_TYPE_SUFFIX
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> Instances.Builder
add(java.lang.Class<T> service, T instance)
Add an instance of a service<T> Instances.Builder
add(TypeQualifier<T> service, T instance)
Add an instance of a serviceInstances
build()
Build theInstances
instanceInstances.Builder
clear()
Clear all instancesInstances.Builder
merge(Instances other, boolean overwrite)
Merge the specified set of instances into this set, overwriting any existing instances with the specified valuesInstances.Builder
remove(java.lang.Class<?> type)
Remove all providers of the specified type<T> Instances.Builder
remove(TypeQualifier<T> service)
Remove all providers of the specified service<T> InstanceProvider<T>
select(TypeQualifier<T> service)
Select all services matching the specifiedTypeQualifier
<T> Instances.Builder
set(java.lang.Class<T> service, T instance)
Set the sole provider of the specified serviceInstances.Builder
set(TypeQualifier<?> service, InstanceProvider<?> provider)
Set the soleInstanceProvider
for the specified service<T> Instances.Builder
set(TypeQualifier<T> qualifier, T instance)
Set the sole implementation of the specified servicejava.lang.String
toString()
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface oracle.dbtools.plugin.api.di.InstanceLocator
select, select
-
-
-
-
Method Detail
-
add
public <T> Instances.Builder add(java.lang.Class<T> service, T instance)
Add an instance of a service- Type Parameters:
T
- The type of the service- Parameters:
service
- The type of the serviceinstance
- The implementation of the service- Returns:
- self
-
add
public <T> Instances.Builder add(TypeQualifier<T> service, T instance)
Add an instance of a service- Type Parameters:
T
- The type of the service- Parameters:
service
- The qualified service typeinstance
- The implementation of the service- Returns:
- self
-
clear
public Instances.Builder clear()
Clear all instances- Returns:
- self
-
merge
public Instances.Builder merge(Instances other, boolean overwrite)
Merge the specified set of instances into this set, overwriting any existing instances with the specified values- Parameters:
other
- The values to merge into the setoverwrite
- Determines the merging behavior. If true then existing matches are replaced with the specified values, if false, existing values are retained, only values not already present are added- Returns:
- self
-
remove
public Instances.Builder remove(java.lang.Class<?> type)
Remove all providers of the specified type- Parameters:
type
- The service type to remove- Returns:
- self
-
remove
public <T> Instances.Builder remove(TypeQualifier<T> service)
Remove all providers of the specified service- Type Parameters:
T
- The type of the service- Parameters:
service
- The qualified service- Returns:
- self
-
select
public <T> InstanceProvider<T> select(TypeQualifier<T> service)
Description copied from interface:InstanceLocator
Select all services matching the specifiedTypeQualifier
- Specified by:
select
in interfaceInstanceLocator
- Type Parameters:
T
- The type of the service to locate- Parameters:
service
- The qualifier that constrains which implementation to match- Returns:
InstanceProvider
for the specified type and qualifier. This value is never null.
-
set
public <T> Instances.Builder set(java.lang.Class<T> service, T instance)
Set the sole provider of the specified service- Type Parameters:
T
- The type of the service- Parameters:
service
- The type of the serviceinstance
- The implementation of the service- Returns:
- self
-
set
public Instances.Builder set(TypeQualifier<?> service, InstanceProvider<?> provider)
Set the soleInstanceProvider
for the specified service- Parameters:
service
- The qualified serviceprovider
- The provider of the service- Returns:
- self
-
set
public <T> Instances.Builder set(TypeQualifier<T> qualifier, T instance)
Set the sole implementation of the specified service- Type Parameters:
T
- The type of the service- Parameters:
qualifier
- The qualified serviceinstance
- The implementation of the service- Returns:
- self
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-