Interface RegistrySpec

    • Method Summary

      All Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      default <O> RegistrySpec add​(com.google.common.reflect.TypeToken<O> type, O object)
      Adds a registry entry that is available by the given type.
      default <O> RegistrySpec add​(java.lang.Class<O> type, O object)
      Adds a registry entry that is available by the given type.
      default RegistrySpec add​(java.lang.Object object)
      Adds a registry entry.
      <O> RegistrySpec addLazy​(com.google.common.reflect.TypeToken<O> type, java.util.function.Supplier<? extends O> supplier)
      Adds a lazily created entry to the registry.
      default <O> RegistrySpec addLazy​(java.lang.Class<O> type, java.util.function.Supplier<? extends O> supplier)
      Adds a lazily created entry to the registry.
      default RegistrySpec with​(Action<? super RegistrySpec> action)
      Executes the given action with this.
    • Method Detail

      • add

        default <O> RegistrySpec add​(java.lang.Class<O> type,
                                     O object)
        Adds a registry entry that is available by the given type.
        Type Parameters:
        O - the public type of the registry entry
        Parameters:
        type - the public type of the registry entry
        object - the actual registry entry
        Returns:
        this
      • add

        default <O> RegistrySpec add​(com.google.common.reflect.TypeToken<O> type,
                                     O object)
        Adds a registry entry that is available by the given type.
        Type Parameters:
        O - the public type of the registry entry
        Parameters:
        type - the public type of the registry entry
        object - the actual registry entry
        Returns:
        this
      • add

        default RegistrySpec add​(java.lang.Object object)
        Adds a registry entry.
        Parameters:
        object - the object to add to the registry
        Returns:
        this
      • addLazy

        default <O> RegistrySpec addLazy​(java.lang.Class<O> type,
                                         java.util.function.Supplier<? extends O> supplier)
        Adds a lazily created entry to the registry.

        The supplier will be invoked exactly once, when a query is made to the registry of a compatible type of the given type.

        Type Parameters:
        O - the public type of the registry entry
        Parameters:
        type - the public type of the registry entry
        supplier - the supplier for creating the object when needed
        Returns:
        this
      • addLazy

        <O> RegistrySpec addLazy​(com.google.common.reflect.TypeToken<O> type,
                                 java.util.function.Supplier<? extends O> supplier)
        Adds a lazily created entry to the registry.

        The supplier will be invoked exactly once, when a query is made to the registry of a compatible type of the given type.

        Type Parameters:
        O - the public type of the registry entry
        Parameters:
        type - the public type of the registry entry
        supplier - the supplier for creating the object when needed
        Returns:
        this
      • with

        default RegistrySpec with​(Action<? super RegistrySpec> action)
                           throws java.lang.Exception
        Executes the given action with this.
        Parameters:
        action - the action
        Returns:
        this
        Throws:
        java.lang.Exception - any thrown by action