Class UserRegistryImposition

  • All Implemented Interfaces:
    Imposition

    public final class UserRegistryImposition
    extends Object
    implements Imposition
    Imposes an extra registry to be joined with the user registry when starting an application.

    If present, the imposed registry will be joined with the user registry specified by RatpackServerSpec.registry(Function). This effectively allows adding extra things to the registry.

    Since:
    1.2
    See Also:
    Impositions
    • Method Detail

      • none

        public static UserRegistryImposition none()
        Creates an imposition of an empty registry.

        This is equivalent to their being no imposition at all.

        Returns:
        a empty user registry imposition
      • of

        public static UserRegistryImposition of​(Registry registry)
        Creates an imposition of the given registry.
        Parameters:
        registry - the registry to join with the user registry
        Returns:
        an imposition of the given registry
      • of

        public static UserRegistryImposition of​(Function<? super Registry,​? extends Registry> registry)
        Creates an imposition of registry returned by the given function.

        The given function receives the user registry as input. The function should not return a registry that has been joined with the input. The user registry is given as input to allow retrieval from the registry.

        Parameters:
        registry - a function that receives the user registry and returns a registry of additions to it
        Returns:
        an imposition of the given registry
      • build

        public Registry build​(Registry userRegistry)
                       throws Exception
        Returns the registry of additions, taking the original user registry as the argument.
        Parameters:
        userRegistry - the user registry
        Returns:
        a registry to join on to the user registry
        Throws:
        Exception - any