@Override
  public void write(final JsonWriter out, final T value) throws IOException {
    final JsonElement tree = delegate.toJsonTree(value);
    if (tree.isJsonObject()) {
      for (Map.Entry<String, List<String>> entry : serializedNameMethods.entrySet()) {
        final String fieldName = entry.getKey();
        final List<String> alternatives = entry.getValue();
        final JsonObject asJsonObject = tree.getAsJsonObject();
        final JsonElement element = asJsonObject.get(fieldName);
        if (element != null) {
          asJsonObject.remove(fieldName);
          asJsonObject.add(alternatives.get(0), element);
        }
      }
    }
    elementAdapter.write(out, tree);
  }
@ Override public void write ( final JsonWriter out , final T value ) throws IOException { final JsonElement tree = delegate . toJsonTree ( value ) ; if ( tree . isJsonObject ( ) ) { for ( Map . Entry < String , List < String > > entry : serializedNameMethods . entrySet ( ) ) { final String fieldName = entry . getKey ( ) ; final List < String > alternatives = entry . getValue ( ) ; final JsonObject asJsonObject = tree . getAsJsonObject ( ) ; final JsonElement element = asJsonObject . get ( fieldName ) ; if ( element != null ) { asJsonObject . remove ( fieldName ) ; asJsonObject . add ( alternatives . get ( 0 ) , element ) ; } } } elementAdapter . write ( out , tree ) ; }
{@inheritDoc}