Class DescriptorBuilderImpl

    • Constructor Detail

      • DescriptorBuilderImpl

        public DescriptorBuilderImpl()
        The basid constructor
      • DescriptorBuilderImpl

        public DescriptorBuilderImpl​(String implementation,
                                     boolean addToContracts)
        A descriptor builder with the given implementation
        Parameters:
        implementation - The implementation this should take
        addToContracts - Whether or not to add the implementation to the set of contracts
    • Method Detail

      • named

        public DescriptorBuilder named​(String name)
                                throws IllegalArgumentException
        Description copied from interface: DescriptorBuilder
        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 DescriptorBuilder
        Parameters:
        name - The name to be associated with this Descriptor
        Returns:
        A DescriptorBuilder with the given name
        Throws:
        IllegalArgumentException - if there is more than one name on the predicate
      • in

        public DescriptorBuilder in​(Class<? extends Annotation> scope)
                             throws IllegalArgumentException
        Description copied from interface: DescriptorBuilder
        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 DescriptorBuilder
        Parameters:
        scope - The class of the scope this descriptor is to have.
        Returns:
        A DescriptorBuilder with the given scope
        Throws:
        IllegalArgumentException - If in is called more than once
      • in

        public DescriptorBuilder in​(String scope)
                             throws IllegalArgumentException
        Description copied from interface: DescriptorBuilder
        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 DescriptorBuilder
        Parameters:
        scope - The fully qualified class name of the scope this predicate is to have.
        Returns:
        A DescriptorBuilder with the given scope
        Throws:
        IllegalArgumentException - If in is called more than once
      • ofRank

        public DescriptorBuilder ofRank​(int rank)
        Description copied from interface: DescriptorBuilder
        The rank to be associated with this descriptor. The last rank bound wins
        Specified by:
        ofRank in interface DescriptorBuilder
        Parameters:
        rank - The rank to be associated with this descriptor.
        Returns:
        A DescriptorBuilder with the given rank
      • proxy

        public DescriptorBuilder proxy()
        Description copied from interface: DescriptorBuilder
        This will cause the isProxiable field of the returned descriptor to return true (it will force this descriptor to use proxies).
        Specified by:
        proxy in interface DescriptorBuilder
        Returns:
        A DescriptorBuilder with the proxiable field set to true
      • proxy

        public DescriptorBuilder proxy​(boolean forceProxy)
        Description copied from interface: DescriptorBuilder
        This will cause the isProxiable field of the returned descriptor to return the given value.
        Specified by:
        proxy in interface DescriptorBuilder
        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 DescriptorBuilder proxyForSameScope()
        Description copied from interface: DescriptorBuilder
        This will cause the isProxyForSameScope field of the returned descriptor to return true (it will force this descriptor to proxy even when injecting into the same scope).
        Specified by:
        proxyForSameScope in interface DescriptorBuilder
        Returns:
        A DescriptorBuilder with the proxyForSameScope field set to true
      • proxyForSameScope

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

        public DescriptorBuilder localOnly()
        Description copied from interface: DescriptorBuilder
        This will cause the descriptorVisibility field of the returned descriptor to return LOCAL
        Specified by:
        localOnly in interface DescriptorBuilder
        Returns:
        A DescriptorBuilder with the descriptorVisibility field to be set to LOCAL
      • visibility

        public DescriptorBuilder visibility​(DescriptorVisibility visibility)
        Description copied from interface: DescriptorBuilder
        This will set the descriptorVisibility field of the returned descriptor
        Specified by:
        visibility in interface DescriptorBuilder
        Parameters:
        visibility - The non-null visibility that this descriptor should take
        Returns:
        A DescriptorBuilder with the descriptorVisibility field set to the input value
      • buildFactory

        public FactoryDescriptors buildFactory​(String factoryScope)
                                        throws IllegalArgumentException
        Description copied from interface: DescriptorBuilder
        Generates a factory descriptor that can be used in binding operations. The generated factory service will have no name, no qualifiers and the same metadata as given to this builder. The generated service will have had the implementation class removed from its set of advertised contracts
        Specified by:
        buildFactory in interface DescriptorBuilder
        Parameters:
        factoryScope - The scope the factory service itself is in.
        Returns:
        The descriptor that has been built up with this DescriptorBuilder
        Throws:
        IllegalArgumentException - if the built descriptor is invalid
      • buildFactory

        public FactoryDescriptors buildFactory()
                                        throws IllegalArgumentException
        Description copied from interface: DescriptorBuilder
        Generates a factory descriptor that can be used in binding operations. The generated factory service will have no name, no qualifiers and the same metadata as given to this builder. The factory will be put into PerLookup scope
        Specified by:
        buildFactory in interface DescriptorBuilder
        Returns:
        The descriptor that has been built up with this DescriptorBuilder
        Throws:
        IllegalArgumentException - if the built descriptor is invalid
      • buildFactory

        public FactoryDescriptors buildFactory​(Class<? extends Annotation> factoryScope)
                                        throws IllegalArgumentException
        Description copied from interface: DescriptorBuilder
        Generates a factory descriptor that can be used in binding operations. The generated factory service will have no name, no qualifiers and the same metadata as given to this builder. The generated service will have had the implementation class removed from its set of advertised contracts
        Specified by:
        buildFactory in interface DescriptorBuilder
        Parameters:
        factoryScope - The scope the factory service itself is in. If this is null the PerLookup scope will be used
        Returns:
        The descriptor that has been built up with this DescriptorBuilder
        Throws:
        IllegalArgumentException - if the built descriptor is invalid