Class InstanceNameValueMapper

  • All Implemented Interfaces:
    IVariableValueMapper

    public class InstanceNameValueMapper
    extends java.lang.Object
    implements IVariableValueMapper
    Implements a simple instance-name based value mapper.
    Author:
    Holger Eichelberger
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static java.lang.String ENACTING  
      private static java.lang.String VALID  
      private java.util.Map<java.lang.String,​java.lang.Object> values  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void clear()
      Clears all values.
      private boolean getBoolean​(IvmlElement element, java.lang.String prefix, boolean deflt)
      Returns a boolean value for element.
      java.lang.Object getValue​(IvmlElement element)
      Returns the value of the specified element.
      boolean isEnacting​(IvmlElement element)
      Returns whether the given element is valid.
      boolean isValid​(IvmlElement element)
      Returns whether the given element is valid.
      void setEnacting​(java.lang.String name, java.lang.Boolean value)
      Defines a enacting flag for element.
      void setEnacting​(IvmlElement element, java.lang.Boolean value)
      Defines the enacting flag for element.
      void setValid​(java.lang.String name, java.lang.Boolean value)
      Defines the validity flag for element.
      void setValid​(IvmlElement element, java.lang.Boolean value)
      Defines the validity flag for element.
      void setValue​(java.lang.String name, java.lang.Object value)
      Defines the value of an IVML element.
      void setValue​(IvmlElement element, java.lang.Object value)
      Defines the value of element.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • values

        private transient java.util.Map<java.lang.String,​java.lang.Object> values
    • Constructor Detail

      • InstanceNameValueMapper

        public InstanceNameValueMapper()
    • Method Detail

      • getBoolean

        private boolean getBoolean​(IvmlElement element,
                                   java.lang.String prefix,
                                   boolean deflt)
        Returns a boolean value for element.
        Parameters:
        element - the element
        prefix - the prefix
        deflt - the default value if the actual value is not defined
        Returns:
        the boolean value
      • isValid

        public boolean isValid​(IvmlElement element)
        Description copied from interface: IVariableValueMapper
        Returns whether the given element is valid.
        Specified by:
        isValid in interface IVariableValueMapper
        Parameters:
        element - the element
        Returns:
        true if valid (also if no mapping), false if invalid
      • isEnacting

        public boolean isEnacting​(IvmlElement element)
        Description copied from interface: IVariableValueMapper
        Returns whether the given element is valid.
        Specified by:
        isEnacting in interface IVariableValueMapper
        Parameters:
        element - the element
        Returns:
        true if valid, false if invalid (also if no mapping)
      • getValue

        public java.lang.Object getValue​(IvmlElement element)
        Description copied from interface: IVariableValueMapper
        Returns the value of the specified element.
        Specified by:
        getValue in interface IVariableValueMapper
        Parameters:
        element - the element
        Returns:
        the value, null if undefined or if there is no mapping
      • setValue

        public void setValue​(IvmlElement element,
                             java.lang.Object value)
        Defines the value of element.
        Parameters:
        element - the element to change the value for
        value - the value (null for undefined)
      • setValue

        public void setValue​(java.lang.String name,
                             java.lang.Object value)
        Defines the value of an IVML element.
        Parameters:
        name - the instance name of the element to change the value for
        value - the value (null for undefined)
      • setValid

        public void setValid​(IvmlElement element,
                             java.lang.Boolean value)
        Defines the validity flag for element.
        Parameters:
        element - the element to change the flag for
        value - the validity flag (null for undefined, the value for the flag)
      • setValid

        public void setValid​(java.lang.String name,
                             java.lang.Boolean value)
        Defines the validity flag for element.
        Parameters:
        name - the instance name of the IVML element to change the flag for
        value - the validity flag (null for undefined)
      • setEnacting

        public void setEnacting​(IvmlElement element,
                                java.lang.Boolean value)
        Defines the enacting flag for element.
        Parameters:
        element - the element to change the flag for
        value - the enacting flag (null for undefined)
      • setEnacting

        public void setEnacting​(java.lang.String name,
                                java.lang.Boolean value)
        Defines a enacting flag for element.
        Parameters:
        name - the instance name of the IVML element to change the flag for
        value - the enacting flag (null for undefined)
      • clear

        public void clear()
        Clears all values.