Documentation of 'org.clapper.util.text.MultipleMapVariableDereferencer' Java class
MultipleMapVariableDereferencer
org.clapper.util.text

Class MultipleMapVariableDereferencer

  • All Implemented Interfaces:
    VariableDereferencer


    public class MultipleMapVariableDereferencer
    extends java.lang.Object
    implements VariableDereferencer
    /**

    The MultipleMapVariableDereferencer class implements the VariableDereferencer interface and resolves variable references by looking them up in one or more supplied Map objects.

    The keys and values in the supplied Map objects must be String objects.

    If more than one contained map has a value for a specific key, the first map's value will be used. ("First", in this case, means the first map added to the MultipleMapVariableDereference object.)

    See Also:
    VariableDereferencer, VariableSubstituter, MapVariableDereferencer
    • Constructor Summary

      Constructors 
      Constructor and Description
      MultipleMapVariableDereferencer()
      Creates a new instance of MultipleMapVariableDereferencer that has no associated Map objects.
      MultipleMapVariableDereferencer(java.util.Map<java.lang.String,java.lang.String>... maps)
      Creates a new instance of MultipleMapVariableDereferencer that is initialized with a specified set of maps.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      void addMap(java.util.Map<java.lang.String,java.lang.String> map)
      Add a map to the list of maps to use when dereferencing variable values.
      java.lang.String getVariableValue(java.lang.String varName, java.lang.Object context)
      Get the value associated with a given variable.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • MultipleMapVariableDereferencer

        public MultipleMapVariableDereferencer(java.util.Map<java.lang.String,java.lang.String>... maps)
        Creates a new instance of MultipleMapVariableDereferencer that is initialized with a specified set of maps.
        Parameters:
        maps - the maps to use
    • Method Detail

      • addMap

        public final void addMap(java.util.Map<java.lang.String,java.lang.String> map)
        Add a map to the list of maps to use when dereferencing variable values. The map is added to the end of the list.
        Parameters:
        map - The map to add
      • getVariableValue

        public java.lang.String getVariableValue(java.lang.String varName,
                                                 java.lang.Object context)
        Get the value associated with a given variable.
        Specified by:
        getVariableValue in interface VariableDereferencer
        Parameters:
        varName - The name of the variable for which the value is desired.
        context - a context object, passed through from the caller to the dereferencer, or null if there isn't one. Ignored here.
        Returns:
        The variable's value. If the variable has no value, this method must return null.

DMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.