Class Bindings


  • public final class Bindings
    extends java.lang.Object
    Utility class to create a new injection binding descriptions for arbitrary Java beans.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private Bindings()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.util.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​(java.lang.Class<T> serviceType)
      Start building a new class-based service binding.
      static <T> ClassBinding<T> service​(javax.ws.rs.core.GenericType<T> serviceType)
      Start building a new generic type-based service binding.
      static <T> InstanceBinding<T> service​(T service)
      Start building a new instance-based service binding.
      static <T> ClassBinding<T> serviceAsContract​(java.lang.Class<T> serviceType)
      Start building a new class-based service binding.
      static <T> ClassBinding<T> serviceAsContract​(java.lang.reflect.Type serviceType)
      Start building a new generic type-based service binding.
      static <T> ClassBinding<T> serviceAsContract​(javax.ws.rs.core.GenericType<T> 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> supplier​(java.lang.Class<? extends java.util.function.Supplier<T>> supplierType)
      Start building a new supplier class-based service binding.
      static <T> SupplierClassBinding<T> supplier​(java.lang.Class<? extends java.util.function.Supplier<T>> supplierType, java.lang.Class<? extends java.lang.annotation.Annotation> supplierScope)
      Start building a new supplier class-based service binding.
      static <T> SupplierInstanceBinding<T> supplier​(java.util.function.Supplier<T> supplier)
      Start building a new supplier instance-based service binding.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Bindings

        private Bindings()
    • Method Detail

      • service

        public static <T> ClassBinding<T> service​(java.lang.Class<T> serviceType)
        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

        public static <T> ClassBinding<T> serviceAsContract​(java.lang.Class<T> serviceType)
        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

        public static <T> ClassBinding<T> service​(javax.ws.rs.core.GenericType<T> serviceType)
        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

        public static <T> ClassBinding<T> serviceAsContract​(javax.ws.rs.core.GenericType<T> serviceType)
        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

        public static <T> ClassBinding<T> serviceAsContract​(java.lang.reflect.Type serviceType)
        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

        public static <T> InstanceBinding<T> service​(T service)
        Start building a new instance-based service binding. The binding is naturally considered to be a singleton-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

        public static <T> InstanceBinding<T> serviceAsContract​(T service)
        Start building a new instance-based service binding. The binding is naturally considered to be a singleton-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​(java.lang.Class<? extends java.util.function.Supplier<T>> supplierType,
                                                           java.lang.Class<? extends java.lang.annotation.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

        public static <T> SupplierClassBinding<T> supplier​(java.lang.Class<? extends java.util.function.Supplier<T>> supplierType)
        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

        public static <T> SupplierInstanceBinding<T> supplier​(java.util.function.Supplier<T> 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 InjectionResolverInjectionResolverBinding<T> injectionResolver​(T resolver)
        Start building a new injection resolver binding. The injection resolver is naturally considered to be a singleton-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.