Package ratpack.exec.registry
Interface RegistrySpec
-
- All Known Subinterfaces:
BindingsSpec
,Execution
,MutableRegistry
,RegistryBuilder
,Request
public interface RegistrySpec
An 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> 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(Class<O> type, O object)
Adds a registry entry that is available by the given type.default RegistrySpec
add(Object object)
Adds a registry entry.<O> RegistrySpec
addLazy(com.google.common.reflect.TypeToken<O> type, Supplier<? extends O> supplier)
Adds a lazily created entry to the registry.default <O> RegistrySpec
addLazy(Class<O> type, Supplier<? extends O> supplier)
Adds a lazily created entry to the registry.default RegistrySpec
with(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
-
-