com.microfocus.awm.control.toolexecution.internal

## Class FlexibleIDMap

- java.lang.Object
- - java.util.AbstractMap<K,V>
  - - java.util.HashMap<java.lang.String,java.lang.Object>
    - - com.microfocus.awm.control.toolexecution.internal.FlexibleIDMap

- All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, java.util.Map<java.lang.String,java.lang.Object>

      public class FlexibleIDMap
      extends java.util.HashMap<java.lang.String,java.lang.Object>

  An implementation of `HashMap` which allows easy access to objects which share the same "main ID". The main ID is handled as an optional prefix for `get(Object)`.

  Example:
  When mapping parameters of a tool type extension, the base ID would be:
  `"com.example.myfunctionpackage.mytooltype."`
  Notice that the dot separator at the end must be included in the base ID string.

  The map would then be able return a mapped input parameter by either:
  `"input.myparameter"`
  or:
  `"com.example.myfunctionpackage.mytooltype.input.myparameter"`

  Author:
    RalfP
  See Also:
    Serialized Form

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class java.util.AbstractMap

      `java.util.AbstractMap.SimpleEntry<K,V>, java.util.AbstractMap.SimpleImmutableEntry<K,V>`

    - ### Nested classes/interfaces inherited from interface java.util.Map

      `java.util.Map.Entry<K,V>`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `FlexibleIDMap(java.lang.String pMainID)` Creates a new flexible ID map.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.lang.Object` | `get(java.lang.Object pKey)`
    `java.lang.Object` | `get(java.lang.Object pKey, boolean pPreferName)` Attempts to get an object with the given key.

    - ### Methods inherited from class java.util.HashMap

      `clear, clone, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, forEach, getOrDefault, isEmpty, keySet, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, values`

    - ### Methods inherited from class java.util.AbstractMap

      `equals, hashCode, toString`

    - ### Methods inherited from class java.lang.Object

      `getClass, notify, notifyAll, wait, wait, wait`

    - ### Methods inherited from interface java.util.Map

      `equals, hashCode`

- - ### Constructor Detail

    - #### FlexibleIDMap

          public FlexibleIDMap(java.lang.String pMainID)

      Creates a new flexible ID map.
      Parameters:
        `pMainID` - the base ID
      See Also:
        `FlexibleIDMap`

  - ### Method Detail

    - #### get

          public java.lang.Object get(java.lang.Object pKey)

      Specified by:
        `get` in interface `java.util.Map<java.lang.String,java.lang.Object>`
      Overrides:
        `get` in class `java.util.HashMap<java.lang.String,java.lang.Object>`

    - #### get

          public java.lang.Object get(java.lang.Object pKey,
                                      boolean pPreferName)

      Attempts to get an object with the given key. The key can be fully qualified (containing the main ID) or relative to the main ID.
      Parameters:
        `pKey` - the key
        `pPreferName` - whether to first treat the given key as a name (prepend the base ID) before checking if it is fully qualified. It is recommended to use `true` if the given key is more likely a name. This is just a minor performance improvement and will not change the outcome of the method.
      Returns:
        the mapped value or `null`

Copyright © 2015 Micro Focus GmbH. All rights reserved.