@Override public @Nullable Object fromJson(JsonReader reader) throws IOException { if (fromAdapter == null) { return delegate.fromJson(reader); } else if (!fromAdapter.nullable && reader.peek() == JsonReader.Token.NULL) { reader.nextNull(); return null; } else { try { return fromAdapter.fromJson(moshi, reader); } catch (InvocationTargetException e) { Throwable cause = e.getCause(); if (cause instanceof IOException) throw (IOException) cause; throw new JsonDataException(cause + " at " + reader.getPath(), cause); } } }
@Override public void toJson(JsonWriter writer, @Nullable Object value) throws IOException { if (toAdapter == null) { delegate.toJson(writer, value); } else if (!toAdapter.nullable && value == null) { writer.nullValue(); } else { try { toAdapter.toJson(moshi, writer, value); } catch (InvocationTargetException e) { Throwable cause = e.getCause(); if (cause instanceof IOException) throw (IOException) cause; throw new JsonDataException(cause + " at " + writer.getPath(), cause); } } }
@Override public void toJson(JsonWriter writer, @Nullable Object value) throws IOException { if (toAdapter == null) { delegate.toJson(writer, value); } else if (!toAdapter.nullable && value == null) { writer.nullValue(); } else { try { toAdapter.toJson(moshi, writer, value); } catch (InvocationTargetException e) { Throwable cause = e.getCause(); if (cause instanceof IOException) throw (IOException) cause; throw new JsonDataException(cause + " at " + writer.getPath(), cause); } } }
@Override public @Nullable Object fromJson(JsonReader reader) throws IOException { if (fromAdapter == null) { return delegate.fromJson(reader); } else if (!fromAdapter.nullable && reader.peek() == JsonReader.Token.NULL) { reader.nextNull(); return null; } else { try { return fromAdapter.fromJson(moshi, reader); } catch (InvocationTargetException e) { Throwable cause = e.getCause(); if (cause instanceof IOException) throw (IOException) cause; throw new JsonDataException(cause + " at " + reader.getPath(), cause); } } }
@Override public void bind(Moshi moshi, JsonAdapter.Factory factory) { super.bind(moshi, factory); delegate = Types.equals(parameterTypes[0], returnType) && qualifierAnnotations.equals(returnTypeAnnotations) ? moshi.nextAdapter(factory, parameterTypes[0], qualifierAnnotations) : moshi.adapter(parameterTypes[0], qualifierAnnotations); }
@Override public void bind(Moshi moshi, JsonAdapter.Factory factory) { super.bind(moshi, factory); delegate = Types.equals(parameterTypes[0], returnType) && qualifierAnnotations.equals(returnTypeAnnotations) ? moshi.nextAdapter(factory, returnType, returnTypeAnnotations) : moshi.adapter(returnType, returnTypeAnnotations); }
@Override public void bind(Moshi moshi, JsonAdapter.Factory factory) { super.bind(moshi, factory); delegate = Types.equals(parameterTypes[0], returnType) && qualifierAnnotations.equals(returnTypeAnnotations) ? moshi.nextAdapter(factory, parameterTypes[0], qualifierAnnotations) : moshi.adapter(parameterTypes[0], qualifierAnnotations); }
@Override public void bind(Moshi moshi, JsonAdapter.Factory factory) { super.bind(moshi, factory); delegate = Types.equals(parameterTypes[0], returnType) && qualifierAnnotations.equals(returnTypeAnnotations) ? moshi.nextAdapter(factory, returnType, returnTypeAnnotations) : moshi.adapter(returnType, returnTypeAnnotations); }