title: getting null value after passing a parameter
body: <p>I am trying to figure out why the value of <code>FinalTransactionSortableField.fromCode(orderBy)</code> is coming out to be null.I am using a REST client with which
  the parameters are getting passed into the following controller method.</p>
  
  <p>I have the following method in my controller class :</p>
  
  <pre><code>public ResponseEntity&lt;SetRESTData&lt;FinancialTransactionDTO&gt;&gt; getTFIUse(
  
      @RequestParam(value = "bId", required = true) final String bId,
      @RequestParam(value = "status", required = false) final String statusString,
      @RequestParam(value = "transactionMethod", required = false) final String transactionMethodString,
      @RequestParam(value = "sortBy", required = false) final String orderBy,
      @RequestParam(value = "sortDirection", required = false) final String sortDirectionString) {
  
      //line 76 below 
      final FinancialTransactionPaginationData paginationData = StringUtils.isBlank(orderBy) ?
        null : new FinancialTransactionPaginationData(FinancialTransactionSortableField.fromCode(orderBy), null, null, sortDirectionString);
      //line# 79 below  
      final ServiceResultDetails&lt;Set&lt;FinancialTransactionDTO&gt;&gt; resultsDetails =
        financialTransactionService.getTransactionsForEmployeeUse(businessId,status, method, paginationData);
  
    }
  </code></pre>
  
  <p>When I put a break point on line #79, I can see that the pagination data is returning null for <code>field</code> as shown in the screenshot below from the debugger in eclipse:</p>
  
  <p><a href="https://i.stack.imgur.com/QaBVG.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/QaBVG.png" alt="enter image description here"></a></p>
  
  <pre><code>The FinalTransactionSortableField class has`fromCode()` method defined as follows :
  
   public static FinancialTransactionSortableField fromCode(final String code) {       
     // Line #61 below
      return CODE_MAP.get(code);
    }
  </code></pre>
  
  <p>When I put the debug point at line #61(return statement), I can see the value <code>createdTs</code> on the debugger in eclipse as follows :</p>
  
  <p><a href="https://i.stack.imgur.com/NcTqH.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/NcTqH.png" alt="enter image description here"></a></p>
  
  <p>For Reference :</p>
  
  <p>1) <code>CODE_MAP</code> is a Map defined in the class FinancialTransactionSortableField as follows :</p>
  
  <pre><code>public enum FinancialTransactionSortableField implements MappableEnum&lt;FinancialTransactionSortableField&gt;, SortableField {
  
    ID(DefaultSortableField.ID.getCode(), "Transaction Id", DefaultSortableField.ID.getColumnName()),
    CASH_AMOUNT("CashAmount", "Cash Amount", "cashAmount"),
    SECURITY_AMOUNT("SecurityAmount", "Security Amount", "securityAmount"),
    STATUS("Status", "Status", "status"),
    CREATED_TS(DefaultSortableField.CREATED_TS.getCode(),
               DefaultSortableField.CREATED_TS.getDescription(),
               DefaultSortableField.CREATED_TS.getColumnName()),;
  
    private final String code;
    private final String description;
    private final String columnName;
  
    private static final Map&lt;String, FinancialTransactionSortableField&gt; CODE_MAP =
      MappableEnumUtil.buildCodeMap(FinancialTransactionSortableField.class);
  
    private FinancialTransactionSortableField(final String code, final String description, final String columnName) {
      this.code = code;
      this.description = description;
      this.columnName = columnName;
    }
  
    @JsonValue
    @Override
    public String getCode() {
      return code;
    }
  
    @Override
    public String getDescription() {
      return description;
    }
  
    @Override
    public String getColumnName() {
      return columnName;
    }
  
    @Override
    public FinancialTransactionSortableField toEnum(final String code) {
      return fromCode(code);
    }
  
    @JsonCreator
    public static FinancialTransactionSortableField fromCode(final String code) {
      return CODE_MAP.get(code);
    }
  
  }
  </code></pre>
  
  <p>2) The implementation of <code>buildCodeMap</code> method is as follows:</p>
  
  <pre><code> public static &lt;E extends Enum&lt;E&gt; &amp; MappableEnum&lt;E&gt;&gt; Map&lt;String, E&gt; buildCodeMap(final Class&lt;E&gt; enumClass) {
      return buildLookupMap(enumClass,
                            new EnumValueGetter&lt;E&gt;() {
                              @Override
                              public Set&lt;String&gt; getKeys(final E e) {
                                final Set&lt;String&gt; set = new LinkedHashSet&lt;String&gt;(1);
                                set.add(e.getCode());
                                return set;
                              }
                            });
    }
  </code></pre>
  
  <p>3) Here is <code>buildLookupMap</code> implementation</p>
  
  <pre><code>public static &lt;E extends Enum&lt;E&gt; &amp; MappableEnum&lt;E&gt;&gt; Map&lt;String, E&gt; buildLookupMap(
      final Class&lt;E&gt; enumClass, final EnumValueGetter&lt;E&gt; getter) {
      final Set&lt;E&gt; values = EnumSet.allOf(enumClass);
      final E enumValue = values.iterator().next();
      addToExampleMap(enumClass, enumValue);
  
      final Map&lt;String, E&gt; lookupMap = new LinkedHashMap&lt;&gt;(values.size());
  
  
      for (final E value : values) {
        final Set&lt;String&gt; keys = getter.getKeys(value);
        for (final String key : keys) {
          if (lookupMap.containsKey(key)) {
            throw new FPIllegalArgumentException("Lookup map for {} has duplicate key {}", enumClass.getSimpleName(), key);
          } else {
            lookupMap.put(key, value);
          }
        }
      }
  
      return lookupMap;
    }
  </code></pre>
  
  <p>4) Implementation of <code>addToExampleMap</code>method and <code>EnumValueGetter</code> interface is as follows which is used above:</p>
  
  <pre><code> private static synchronized &lt;E extends Enum&lt;E&gt; &amp; MappableEnum&lt;E&gt;&gt; void addToExampleMap(
      final Class&lt;E&gt; enumClass, final E enumValue) {
      if (!EXAMPLE_MAP.containsKey(enumClass)) {
        EXAMPLE_MAP.put(enumClass, enumValue);
      }
    } 
  
  public static interface EnumValueGetter&lt;E extends Enum&lt;E&gt; &amp; MappableEnum&lt;E&gt;&gt; {
      Set&lt;String&gt; getKeys(E e);
    }
  </code></pre>
  
  <p>and <code>EXAMPLE_MAP</code> is a map which is declared in the class at the start like this :</p>
  
  <pre><code>private static final Map&lt;Class&lt;?&gt;, MappableEnum&lt;?&gt;&gt; EXAMPLE_MAP =
      new ConcurrentHashMap&lt;Class&lt;?&gt;, MappableEnum&lt;?&gt;&gt;(1000);
  </code></pre>
  
  <p>Can anyone see what's wrong? Please let me know if more information is needed.</p>