Class Bindings
java.lang.Object
org.glassfish.jersey.internal.inject.Bindings
Utility class to create a new injection binding descriptions for arbitrary Java beans.
- Author:
- Petr Bouda
-
Method Summary
Modifier and TypeMethodDescriptionstatic Collection<Binding>
getBindings
(InjectionManager injectionManager, Binder binder) static <T extends InjectionResolver>
InjectionResolverBinding<T>injectionResolver
(T resolver) Start building a new injection resolver binding.static <T> ClassBinding<T>
service
(GenericType<T> serviceType) Start building a new generic type-based service binding.static <T> ClassBinding<T>
Start building a new class-based service binding.static <T> InstanceBinding<T>
service
(T service) Start building a new instance-based service binding.static <T> ClassBinding<T>
serviceAsContract
(GenericType<T> serviceType) Start building a new generic type-based service binding.static <T> ClassBinding<T>
serviceAsContract
(Class<T> serviceType) Start building a new class-based service binding.static <T> ClassBinding<T>
serviceAsContract
(Type serviceType) Start building a new generic type-based service binding.static <T> InstanceBinding<T>
serviceAsContract
(T service) Start building a new instance-based service binding.static <T> SupplierClassBinding<T>
Start building a new supplier class-based service binding.static <T> SupplierClassBinding<T>
supplier
(Class<? extends Supplier<T>> supplierType, Class<? extends Annotation> supplierScope) Start building a new supplier class-based service binding.static <T> SupplierInstanceBinding<T>
Start building a new supplier instance-based service binding.
-
Method Details
-
getBindings
-
service
Start building a new class-based service binding.Does NOT service the service type itself as a contract type.
- Type Parameters:
T
- service type.- Parameters:
serviceType
- service class.- Returns:
- initialized binding builder.
-
serviceAsContract
Start building a new class-based service binding.Binds the service type itself as a contract type.
- Type Parameters:
T
- service type.- Parameters:
serviceType
- service class.- Returns:
- initialized binding builder.
-
service
Start building a new generic type-based service binding.Binds the generic service type itself as a contract type.
- Type Parameters:
T
- service type.- Parameters:
serviceType
- generic service type information.- Returns:
- initialized binding builder.
-
serviceAsContract
Start building a new generic type-based service binding.Binds the generic service type itself as a contract type.
- Type Parameters:
T
- service type.- Parameters:
serviceType
- generic service type information.- Returns:
- initialized binding builder.
-
serviceAsContract
Start building a new generic type-based service binding.Binds the generic service type itself as a contract type.
- Type Parameters:
T
- service type.- Parameters:
serviceType
- generic service type information.- Returns:
- initialized binding builder.
-
service
Start building a new instance-based service binding. The binding is naturally considered to be asingleton-scoped
.Does NOT service the service type itself as a contract type.
- Type Parameters:
T
- service type.- Parameters:
service
- service instance.- Returns:
- initialized binding builder.
-
serviceAsContract
Start building a new instance-based service binding. The binding is naturally considered to be asingleton-scoped
.Binds the generic service type itself as a contract type.
- Type Parameters:
T
- service type.- Parameters:
service
- service instance.- Returns:
- initialized binding builder.
-
supplier
public static <T> SupplierClassBinding<T> supplier(Class<? extends Supplier<T>> supplierType, Class<? extends Annotation> supplierScope) Start building a new supplier class-based service binding.- Type Parameters:
T
- service type.- Parameters:
supplierType
- service supplier class.supplierScope
- factory scope.- Returns:
- initialized binding builder.
-
supplier
Start building a new supplier class-based service binding.The supplier itself is bound in a per-lookup scope.
- Type Parameters:
T
- service type.- Parameters:
supplierType
- service supplier class.- Returns:
- initialized binding builder.
-
supplier
Start building a new supplier instance-based service binding.- Type Parameters:
T
- service type.- Parameters:
supplier
- service instance.- Returns:
- initialized binding builder.
-
injectionResolver
public static <T extends InjectionResolver> InjectionResolverBinding<T> injectionResolver(T resolver) Start building a new injection resolver binding. The injection resolver is naturally considered to be asingleton-scoped
.There is no need to provide any additional information. Other method on
Binding
will be ignored.- Type Parameters:
T
- type of the injection resolver.- Parameters:
resolver
- injection resolver instance.- Returns:
- initialized binding builder.
-