B
- The type of Component containedpublic class Component<B> extends Object
Constructor and Description |
---|
Component(Configuration config,
String name,
Function<Configuration,? extends B> builderFunction)
Creates a component for the given
config with given name created by the given builderFunction . |
Component(Supplier<Configuration> config,
String name,
Function<Configuration,? extends B> builderFunction)
Creates a component for the given
config with given name created by the given builderFunction . |
Modifier and Type | Method and Description |
---|---|
B |
get()
Retrieves the object contained in this component, triggering the builder function if the component hasn't been
built yet.
|
boolean |
isInitialized()
Checks if the component is already initialized.
|
void |
update(Function<Configuration,? extends B> builderFunction)
Updates the builder function for this component.
|
public Component(Configuration config, String name, Function<Configuration,? extends B> builderFunction)
config
with given name
created by the given builderFunction
. Then the Configuration is not initialized yet, consider using Component(Supplier,
String, Function)
instead.config
- The Configuration the component is part ofname
- The name of the componentbuilderFunction
- The builder function of the componentpublic Component(@Nonnull Supplier<Configuration> config, @Nonnull String name, @Nonnull Function<Configuration,? extends B> builderFunction)
config
with given name
created by the given builderFunction
.config
- The supplier function of the configurationname
- The name of the componentbuilderFunction
- The builder function of the componentpublic B get()
LifecycleHandlerInspector.registerLifecycleHandlers(Configuration,
Object)
methods will be called to resolve and register lifecycle methods.public void update(@Nonnull Function<Configuration,? extends B> builderFunction)
builderFunction
- The new builder function for the componentIllegalStateException
- when the component has already been retrieved using get()
.public boolean isInitialized()
Copyright © 2010–2024. All rights reserved.