Package ratpack.exec.registry
Interface RegistrySpec
-
- All Known Subinterfaces:
BindingsSpec,Execution,MutableRegistry,RegistryBuilder,Request
public interface RegistrySpecAn additive specification of a registry.- See Also:
RegistryBuilder
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default <O> RegistrySpecadd(com.google.common.reflect.TypeToken<O> type, O object)Adds a registry entry that is available by the given type.default <O> RegistrySpecadd(Class<O> type, O object)Adds a registry entry that is available by the given type.default RegistrySpecadd(Object object)Adds a registry entry.<O> RegistrySpecaddLazy(com.google.common.reflect.TypeToken<O> type, Supplier<? extends O> supplier)Adds a lazily created entry to the registry.default <O> RegistrySpecaddLazy(Class<O> type, Supplier<? extends O> supplier)Adds a lazily created entry to the registry.default RegistrySpecwith(Action<? super RegistrySpec> action)Executes the given action withthis.
-
-
-
Method Detail
-
add
default <O> RegistrySpec add(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 entryobject- 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 entryobject- the actual registry entry- Returns:
- this
-
add
default RegistrySpec add(Object object)
Adds a registry entry.- Parameters:
object- the object to add to the registry- Returns:
- this
-
addLazy
default <O> RegistrySpec addLazy(Class<O> type, 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 entrysupplier- the supplier for creating the object when needed- Returns:
- this
-
addLazy
<O> RegistrySpec addLazy(com.google.common.reflect.TypeToken<O> type, 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 entrysupplier- the supplier for creating the object when needed- Returns:
- this
-
with
default RegistrySpec with(Action<? super RegistrySpec> action) throws Exception
Executes the given action withthis.- Parameters:
action- the action- Returns:
this- Throws:
Exception- any thrown byaction
-
-