Interface Context



  • public interface Context
    Base context interface from which all context implementations extend.
    • Method Detail

      • getSettings

        Stream<Settings> getSettings​()
        The settings for the component that this context is being passed to.
      • getSettings

        default <T extends SettingsOptional<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 create
        defaultValue - 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 ResourceOptional<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 ResourceOptional<T> getResource​(Class<T> clazz)
        Return any resource (if there is one) of the specified type
      • getResources

        <T extends ResourceStream<T> getResources​(Class<T> clazz)
        Return all resources of the specified type