title: Validate with Gson
body: <p>I want to check for valid Integer's when deserializing with GSON and report errors to an resultList object.</p>
  
  <p>So I have this (register the Integer type) to GsonBuilder:</p>
  
  <pre><code>gson.registerTypeAdapter(Integer.class, new IntegerDeserializer(resultList));
  </code></pre>
  
  <p>And the IntegerDeserializer looks like</p>
  
  <pre><code>@Override
  public Integer deserialize(JsonElement element, Type arg1, JsonDeserializationContext context) throws JsonParseException {
  
      String integer = element.getAsString();
  
      try {
          Integer value = Integer.valueOf(integer);
          return value;
      } catch (NumberFormatException e) {
          resultList.addError("?? fieldname ?? ", "Invalid number");
          return null;
      }
  }
  </code></pre>
  
  <p>Is there a way to get the field name of the current Integer that is parsed?
  If this works I can use this as a generic way for checking json fields. </p>