-
public interface Context
Base context interface from which all context implementations extend.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default <T extends Resource>
Optional<T>getResource(Class<T> clazz)
Return any resource (if there is one) of the specified type<T extends Resource>
Optional<T>getResource(String key, Class<T> clazz)
Find the resource of the given type associated with the given keyStream<String>
getResourceKeys()
List all the resource keys contained within this contextdefault Stream<String>
getResourceKeys(Class<? extends Resource> clazz)
List all the resource keys contained within this context that are of the specified type<T extends Resource>
Stream<T>getResources(Class<T> clazz)
Return all resources of the specified typeStream<Settings>
getSettings()
The settings for the component that this context is being passed to.default <T extends Settings>
Optional<T>getSettings(Class<T> clazz)
Return a settings object as the given class.default <T extends Settings>
TgetSettings(Class<T> clazz, T defaultValue)
Return a settings object as the given class, attempting to create a new settings object of that class if the currently given settings are not of this class.
-
-
-
Method Detail
-
getSettings
Stream<Settings> getSettings()
The settings for the component that this context is being passed to.
-
getSettings
default <T extends Settings> Optional<T> getSettings(Class<T> clazz)
Return a settings object as the given class.
-
getSettings
default <T extends Settings> T getSettings(Class<T> clazz, T defaultValue)
Return a settings object as the given class, attempting to create a new settings object of that class if the currently given settings are not of this class.- Parameters:
clazz
- the setting clazz to createdefaultValue
- if non=null this will be returned if the settings are absensce. If null then will try to create a new instances of the Settings class- Returns:
- may be null (if defaultValue is null)
-
getResource
<T extends Resource> Optional<T> getResource(String key, Class<T> clazz)
Find the resource of the given type associated with the given key- Parameters:
key
- the key (if null / empty then any resource can be returned)clazz
- the required resource class- Returns:
- resouce if found
-
getResourceKeys
Stream<String> getResourceKeys()
List all the resource keys contained within this context
-
getResourceKeys
default Stream<String> getResourceKeys(Class<? extends Resource> clazz)
List all the resource keys contained within this context that are of the specified type
-
getResource
default <T extends Resource> Optional<T> getResource(Class<T> clazz)
Return any resource (if there is one) of the specified type
-
-