public abstract class RegistrySpecAction extends Object implements Action<RegistrySpec>, RegistrySpec
Constructor and Description |
---|
RegistrySpecAction() |
Modifier and Type | Method and Description |
---|---|
<O> RegistrySpec |
add(Class<? super O> type,
O object)
Adds a registry entry that is available by the given type.
|
<O> RegistrySpec |
add(Class<O> type,
Factory<? extends O> factory)
Adds a lazily created entry to the registry.
|
RegistrySpec |
add(Object object)
Adds a registry entry.
|
<O> RegistrySpec |
add(TypeToken<? super O> type,
O object)
Adds a registry entry that is available by the given type.
|
<O> RegistrySpec |
add(TypeToken<O> type,
Factory<? extends O> factory)
Adds a lazily created entry to the registry.
|
protected abstract void |
execute()
Implementations can naturally use the
RegistrySpec DSL for the duration of this method. |
void |
execute(RegistrySpec registrySpec)
Delegates to
execute() , using the given registrySpec for delegation. |
protected RegistrySpec |
getRegistrySpec()
Returns the registry spec being delegated to.
|
protected RegistrySpec getRegistrySpec() throws IllegalStateException
IllegalStateException
- if called outside of execute()
public final void execute(RegistrySpec registrySpec) throws Exception
execute()
, using the given registrySpec
for delegation.execute
in interface Action<RegistrySpec>
registrySpec
- the registry specException
- Any thrown by execute()
protected abstract void execute() throws Exception
RegistrySpec
DSL for the duration of this method.Exception
- Any exception thrown while adding to the registrypublic <O> RegistrySpec add(Class<? super O> type, O object)
add
in interface RegistrySpec
O
- the public type of the registry entrytype
- the public type of the registry entryobject
- the actual registry entrypublic <O> RegistrySpec add(TypeToken<? super O> type, O object)
add
in interface RegistrySpec
O
- the public type of the registry entrytype
- the public type of the registry entryobject
- the actual registry entrypublic RegistrySpec add(Object object)
add
in interface RegistrySpec
object
- the object to add to the registrypublic <O> RegistrySpec add(Class<O> type, Factory<? extends O> factory)
The factory will be invoked exactly once, when a query is made to the registry of a compatible type of the given type.
add
in interface RegistrySpec
O
- the public type of the registry entrytype
- the public type of the registry entryfactory
- the factory for creating the object when neededpublic <O> RegistrySpec add(TypeToken<O> type, Factory<? extends O> factory)
The factory will be invoked exactly once, when a query is made to the registry of a compatible type of the given type.
add
in interface RegistrySpec
O
- the public type of the registry entrytype
- the public type of the registry entryfactory
- the factory for creating the object when needed