Class UserRegistryImposition

  • All Implemented Interfaces:
    Imposition

    public final class UserRegistryImposition
    extends java.lang.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 Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      ratpack.registry.Registry build​(ratpack.registry.Registry userRegistry)
      Returns the registry of additions, taking the original user registry as the argument
      static UserRegistryImposition none()
      Creates an imposition of an empty registry.
      static UserRegistryImposition of​(ratpack.func.Function<? super ratpack.registry.Registry,​? extends ratpack.registry.Registry> registry)
      Creates an imposition of registry returned by the given function.
      static UserRegistryImposition of​(ratpack.registry.Registry registry)
      Creates an imposition of the given registry.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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​(ratpack.registry.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​(ratpack.func.Function<? super ratpack.registry.Registry,​? extends ratpack.registry.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 ratpack.registry.Registry build​(ratpack.registry.Registry userRegistry)
                                        throws java.lang.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:
        java.lang.Exception - any