Interface ApplicationContext

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Constructor Summary

      Constructors 
      Constructor Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Constructor Detail

    • Method Detail

      • getName

         abstract String getName()

        Application context name

        Returns:

        Application context name

      • getPermittedKeys

         abstract Set<Key<?>> getPermittedKeys()

        Keys permitted for this context. Empty set means all keys permitted.

        Implementations should allow setting up of PermittedKeys at time of context initialization

        Returns:

        set of permitted keys

      • isKeyValid

         abstract Boolean isKeyValid(Key<?> key)

        Checks if key is valid for this context.

        Returns:

        key

      • addIfNotPresent

         abstract <T extends Any> Unit addIfNotPresent(Key<T> key, T value)

        Add value for given key if not already present.

        This is semmantically same as

        if(!exists(key)) add(key, value) *

        Parameters:
        value - </T>
      • addWithOverwrite

         abstract <T extends Any> Object addWithOverwrite(Key<T> key, T value)

        Add value for given key even if already present.

        Returns:

        Previous value associated with key if any or null </T>

      • add

         abstract <T extends Any> Unit add(Key<T> key, T value)

        Add value for given key.

        Parameters:
        value - </T>
      • exists

         abstract <T extends Any> Boolean exists(Key<T> key)

        Check if any value or null associated with give key

        Returns:

        true if value or null associated with give key otherwise false </T>

      • fetch

         abstract <T extends Any> T fetch(Key<T> key)

        Fetch value associated with key or null

        Returns:

        value associated with key or null </T>

      • erase

         abstract <T extends Any> T erase(Key<T> key)

        Erase value associated with key if any

        Returns:

        value associate with key or null </T>

      • clear

         abstract Unit clear()

        Clear the entire context

      • keySet

         abstract Set<Key<?>> keySet()

        Get a set of keys in context

        Returns:

        set of keys in context

      • clone

         abstract ApplicationContext clone(String cloneName, Set<Key<?>> clonePermittedKeys)

        Creates a clone of this context with passed cloneName and clonePermittedKeys. While cloning only the permittedKeys will be added

        Parameters:
        cloneName - name of the cloned ApplicationContext
        clonePermittedKeys - permittedKeys of the cloned ApplicationContext