com.scarabsoft.jrest.converter.exception.GsonExceptionConverter Maven / Gradle / Ivy
package com.scarabsoft.jrest.converter.exception;
import com.google.gson.TypeAdapter;
import com.google.gson.stream.JsonReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Collection;
public class GsonExceptionConverter implements ExceptionConverter {
private final TypeAdapter typeAdapter;
public GsonExceptionConverter(TypeAdapter typeAdapter) {
this.typeAdapter = typeAdapter;
}
@Override
public T convert(InputStream inputStream) throws IOException {
return typeAdapter.read(new JsonReader(new InputStreamReader(inputStream)));
}
@Override
public Collection convertCollection(InputStream inputStream, Class extends Collection> collectionClazz) throws IOException {
throw new RuntimeException("not supported yet.");
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy