Class ContractProvider.Builder

  • Enclosing class:
    ContractProvider

    public static final class ContractProvider.Builder
    extends Object
    Contract provider model builder.
    • Method Detail

      • scope

        public ContractProvider.Builder scope​(Class<? extends Annotation> scope)
        Change contract provider scope. (Default scope is Singleton.)
        Parameters:
        scope - contract provider scope.
        Returns:
        updated builder.
      • addContract

        public ContractProvider.Builder addContract​(Class<?> contract)
        Add a new provided contract.
        Parameters:
        contract - additional provided contract.
        Returns:
        updated builder.
      • addContract

        public ContractProvider.Builder addContract​(Class<?> contract,
                                                    int priority)
        Add a new provided contract with priority.
        Parameters:
        contract - additional provided contract.
        priority - priority for the contract.
        Returns:
        updated builder.
      • addContracts

        public ContractProvider.Builder addContracts​(Map<Class<?>,​Integer> contracts)
        Add a new provided contracts.
        Parameters:
        contracts - additional provided contracts.
        Returns:
        updated builder.
      • addContracts

        public ContractProvider.Builder addContracts​(Collection<Class<?>> contracts)
        Add a new provided contracts.
        Parameters:
        contracts - additional provided contracts.
        Returns:
        updated builder.
      • defaultPriority

        public ContractProvider.Builder defaultPriority​(int defaultPriority)
        Set the contract default provider priority. (Default value is ContractProvider.NO_PRIORITY)
        Parameters:
        defaultPriority - default contract provider priority.
        Returns:
        updated builder.
      • addNameBinding

        public ContractProvider.Builder addNameBinding​(Class<? extends Annotation> binding)
        Add a new contract provider name binding.
        Parameters:
        binding - name binding.
        Returns:
        updated builder.
      • getScope

        public Class<? extends Annotation> getScope()
        Get the scope of the built contract provider model.
        Returns:
        scope associated with the model or null if no scope has been set explicitly.
      • getContracts

        public Map<Class<?>,​Integer> getContracts()
        Get the map of contracts for the built contract provider model.
        Returns:
        contracts associated with the model.
      • getDefaultPriority

        public int getDefaultPriority()
        Get the default priority of the built contract provider model.
        Returns:
        default priority associated with the model.
      • getNameBindings

        public Set<Class<? extends Annotation>> getNameBindings()
        Get name bindings of the built contract provider model.
        Returns:
        name bindings associated with the model.
      • build

        public ContractProvider build()
        Build a new contract provider model.
        Returns:
        new contract provider model.