Class DynamicContextVariables

  • All Implemented Interfaces:
    ContextVariables

    public class DynamicContextVariables
    extends Object
    implements ContextVariables
    A variable provider that provides values using SingleValueProvider
    Author:
    Yegor.Yarko Date: 30.08.2008
    • Constructor Detail

      • DynamicContextVariables

        public DynamicContextVariables()
    • Method Detail

      • put

        public Object put​(@NotNull
                          String name,
                          @NotNull
                          SingleValueProvider provider)
        Adds a variable to the provider
        Parameters:
        name - the name of the variable to add
        provider - provider to use to get the variable value
        Returns:
        previous value associated with specified name, or null if there was no mapping for name
      • remove

        public Object remove​(@NotNull
                             String name)
        Removes the variable form the provider
        Parameters:
        name - name whose mapping is to be removed from the map.
        Returns:
        previous value associated with specified name, or null if there was no mapping for name
      • get

        @Nullable
        public Object get​(@NotNull
                          String name)
        Calculates the variable value using the configured provider for the name and returns it
        Specified by:
        get in interface ContextVariables
        Parameters:
        name - the name of the variable
        Returns:
        the variable, which is calculated using the single value provider associated with the name
      • size

        public int size()
        Description copied from interface: ContextVariables
        Returns the number of variables in this variables provider. This is the size of the map returned by getAll method.
        Specified by:
        size in interface ContextVariables
        Returns:
        the number of variables stored in the provider