Class ActiveDescriptorBuilderImpl

    • Field Detail

      • name

        private java.lang.String name
      • contracts

        private final java.util.HashSet<java.lang.reflect.Type> contracts
      • scopeAnnotation

        private java.lang.annotation.Annotation scopeAnnotation
      • scope

        private java.lang.Class<? extends java.lang.annotation.Annotation> scope
      • qualifiers

        private final java.util.HashSet<java.lang.annotation.Annotation> qualifiers
      • metadatas

        private final java.util.HashMap<java.lang.String,​java.util.List<java.lang.String>> metadatas
      • implementation

        private final java.lang.Class<?> implementation
      • rank

        private int rank
      • proxy

        private java.lang.Boolean proxy
      • proxyForSameScope

        private java.lang.Boolean proxyForSameScope
      • classAnalysisName

        private java.lang.String classAnalysisName
      • implementationType

        private java.lang.reflect.Type implementationType
    • Constructor Detail

      • ActiveDescriptorBuilderImpl

        public ActiveDescriptorBuilderImpl​(java.lang.Class<?> implementation)
        constructor with the impl class
        Parameters:
        implementation - The implementation class (may be null)
    • Method Detail

      • named

        public ActiveDescriptorBuilder named​(java.lang.String name)
                                      throws java.lang.IllegalArgumentException
        Description copied from interface: ActiveDescriptorBuilder
        The name for this descriptor object. Note that at the current time a descriptor can only have one name, hence this method will throw an IllegalArgumentException if named is called more than once.
        Specified by:
        named in interface ActiveDescriptorBuilder
        Parameters:
        name - The name to be associated with this Descriptor
        Returns:
        A DescriptorBuilder with the given name
        Throws:
        java.lang.IllegalArgumentException - if there is more than one name on the predicate
      • to

        public ActiveDescriptorBuilder to​(java.lang.reflect.Type contract)
                                   throws java.lang.IllegalArgumentException
        Description copied from interface: ActiveDescriptorBuilder
        A contract to be associated with this descriptor object.
        Specified by:
        to in interface ActiveDescriptorBuilder
        Parameters:
        contract - A class that is annotated with Contract to be associated with this Descriptor
        Returns:
        A DescriptorBuilder with the given name
        Throws:
        java.lang.IllegalArgumentException - on failures
      • in

        public ActiveDescriptorBuilder in​(java.lang.annotation.Annotation scopeAnnotation)
                                   throws java.lang.IllegalArgumentException
        Description copied from interface: ActiveDescriptorBuilder
        A scope to be associated with this descriptor object. Note that at the current time a descriptor can only have one scope, hence this method will throw an IllegalArgumentException if in is called more than once.
        Specified by:
        in in interface ActiveDescriptorBuilder
        Parameters:
        scopeAnnotation - The class of the scope this descriptor is to have.
        Returns:
        A DescriptorBuilder with the given scope
        Throws:
        java.lang.IllegalArgumentException - If in is called more than once
      • in

        public ActiveDescriptorBuilder in​(java.lang.Class<? extends java.lang.annotation.Annotation> scope)
                                   throws java.lang.IllegalArgumentException
        Description copied from interface: ActiveDescriptorBuilder
        A scope to be associated with this descriptor object. Note that at the current time a descriptor can only have one scope, hence this method will throw an IllegalArgumentException if in is called more than once.
        Specified by:
        in in interface ActiveDescriptorBuilder
        Parameters:
        scope - The class of the scope this descriptor is to have.
        Returns:
        A DescriptorBuilder with the given scope
        Throws:
        java.lang.IllegalArgumentException - If in is called more than once
      • qualifiedBy

        public ActiveDescriptorBuilder qualifiedBy​(java.lang.annotation.Annotation annotation)
                                            throws java.lang.IllegalArgumentException
        Description copied from interface: ActiveDescriptorBuilder
        A qualifier to be associated with this descriptor object
        Specified by:
        qualifiedBy in interface ActiveDescriptorBuilder
        Parameters:
        annotation - The annotation to be associated with this descriptor
        Returns:
        A DescriptorBuilder with the given annotation
        Throws:
        java.lang.IllegalArgumentException - on failures
      • has

        public ActiveDescriptorBuilder has​(java.lang.String key,
                                           java.lang.String value)
                                    throws java.lang.IllegalArgumentException
        Description copied from interface: ActiveDescriptorBuilder
        An instance of data to be associated with this descriptor
        Specified by:
        has in interface ActiveDescriptorBuilder
        Parameters:
        key - The key for the data to be associated with this descriptor
        value - The value this key should take (single value metadata)
        Returns:
        A DescriptorBuilder with the given metadata
        Throws:
        java.lang.IllegalArgumentException
      • has

        public ActiveDescriptorBuilder has​(java.lang.String key,
                                           java.util.List<java.lang.String> values)
                                    throws java.lang.IllegalArgumentException
        Description copied from interface: ActiveDescriptorBuilder
        An instance of data to be associated with this descriptor
        Specified by:
        has in interface ActiveDescriptorBuilder
        Parameters:
        key - The key for the data to be associated with this descriptor
        values - The values this key should take (single value metadata)
        Returns:
        A DescriptorBuilder with the given metadata
        Throws:
        java.lang.IllegalArgumentException
      • proxy

        public ActiveDescriptorBuilder proxy​(boolean forceProxy)
        Description copied from interface: ActiveDescriptorBuilder
        This will cause the isProxiable field of the returned descriptor to return the given value.
        Specified by:
        proxy in interface ActiveDescriptorBuilder
        Parameters:
        forceProxy - if true then this descriptor will be proxied, if false then this descriptor will NOT be proxied
        Returns:
        A DescriptorBuilder with the proxiable field set to the given value
      • proxyForSameScope

        public ActiveDescriptorBuilder proxyForSameScope()
        Description copied from interface: ActiveDescriptorBuilder
        This will cause the isProxyForSameScope field of the returned descriptor to return true (it will force this descriptor to use proxies even when injecting into the same scope).
        Specified by:
        proxyForSameScope in interface ActiveDescriptorBuilder
        Returns:
        A DescriptorBuilder with the proxyForSameScope field set to true
      • proxyForSameScope

        public ActiveDescriptorBuilder proxyForSameScope​(boolean forceProxyForSameScope)
        Description copied from interface: ActiveDescriptorBuilder
        This will cause the isProxyForSameScope field of the returned descriptor to return the given value.
        Specified by:
        proxyForSameScope in interface ActiveDescriptorBuilder
        Parameters:
        forceProxyForSameScope - if true then this descriptor will be proxied even if the scope of the injectee is the same, if false then this descriptor will NOT be proxied, even if the scope of the injectee is the same
        Returns:
        A DescriptorBuilder with the proxyForSameScope field set to the given value
      • andLoadWith

        public ActiveDescriptorBuilder andLoadWith​(HK2Loader loader)
                                            throws java.lang.IllegalArgumentException
        Description copied from interface: ActiveDescriptorBuilder
        Call this if this descriptor should be loaded with the given HK2Loader
        Specified by:
        andLoadWith in interface ActiveDescriptorBuilder
        Parameters:
        loader - The loader to use with this descriptor
        Returns:
        A DescriptorBuilder with the given HK2Loader
        Throws:
        java.lang.IllegalArgumentException - if the HK2Loader is set non-null more than once
      • asType

        public ActiveDescriptorBuilder asType​(java.lang.reflect.Type t)
        Description copied from interface: ActiveDescriptorBuilder
        Call this if the parameterized type of the implementation class is known. This may be called with any Type, but only a ParameterizedType based on the implementationClass will work
        Specified by:
        asType in interface ActiveDescriptorBuilder
        Parameters:
        t - The non-null ParameterizedType describing the implementation
        Returns:
        A DescriptorBuilder with the given implementationType
      • build

        public <T> AbstractActiveDescriptor<T> build()
                                              throws java.lang.IllegalArgumentException
        Description copied from interface: ActiveDescriptorBuilder
        Generates a descriptor that can be used in binding operations
        Specified by:
        build in interface ActiveDescriptorBuilder
        Returns:
        The descriptor that has been built up
        Throws:
        java.lang.IllegalArgumentException - if the built descriptor is invalid
      • buildFactory

        @Deprecated
        public <T> AbstractActiveDescriptor<T> buildFactory()
                                                     throws java.lang.IllegalArgumentException
        Deprecated.
        Description copied from interface: ActiveDescriptorBuilder
        Generates a descriptor that can be used in binding operations that describes a factorys provide method
        Specified by:
        buildFactory in interface ActiveDescriptorBuilder
        Returns:
        The descriptor that has been built up, of type PROVIDE_METHOD
        Throws:
        java.lang.IllegalArgumentException - if the built descriptor is invalid
      • buildProvideMethod

        public <T> AbstractActiveDescriptor<T> buildProvideMethod()
                                                           throws java.lang.IllegalArgumentException
        Description copied from interface: ActiveDescriptorBuilder
        Generates a descriptor that can be used in binding operations that describes a factorys provide method
        Specified by:
        buildProvideMethod in interface ActiveDescriptorBuilder
        Returns:
        The descriptor that has been built up, of type PROVIDE_METHOD
        Throws:
        java.lang.IllegalArgumentException - if the built descriptor is invalid