Browse Source

Merge pull request #52 from jochenberger/remove-unused-jsonprovider-methods

remove unused methods from `JsonProvider` interface
pull/55/head
kallestenflo 10 years ago
parent
commit
49d1dda7a8
  1. 1
      json-path/src/main/java/com/jayway/jsonpath/internal/spi/json/AbstractJsonProvider.java
  2. 10
      json-path/src/main/java/com/jayway/jsonpath/internal/spi/json/GsonProvider.java
  3. 17
      json-path/src/main/java/com/jayway/jsonpath/internal/spi/json/JacksonProvider.java
  4. 14
      json-path/src/main/java/com/jayway/jsonpath/internal/spi/json/JsonSmartJsonProvider.java
  5. 5
      json-path/src/main/java/com/jayway/jsonpath/spi/json/JsonProvider.java

1
json-path/src/main/java/com/jayway/jsonpath/internal/spi/json/AbstractJsonProvider.java

@ -20,7 +20,6 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Map;

10
json-path/src/main/java/com/jayway/jsonpath/internal/spi/json/GsonProvider.java

@ -163,11 +163,6 @@ public class GsonProvider extends AbstractJsonProvider {
return parser.parse(json);
}
@Override
public Object parse(Reader jsonReader) throws InvalidJsonException {
return parser.parse(jsonReader);
}
@Override
public Object parse(InputStream jsonStream) throws InvalidJsonException {
return parser.parse(new InputStreamReader(jsonStream));
@ -184,11 +179,6 @@ public class GsonProvider extends AbstractJsonProvider {
return JsonNull.INSTANCE;
}
@Override
public Object createMap() {
return new JsonObject();
}
@Override
public Object createArray() {
return new JsonArray();

17
json-path/src/main/java/com/jayway/jsonpath/internal/spi/json/JacksonProvider.java

@ -23,12 +23,9 @@ import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.io.InputStream;
import java.io.Reader;
import java.io.StringWriter;
import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
public class JacksonProvider extends AbstractJsonProvider {
@ -75,15 +72,6 @@ public class JacksonProvider extends AbstractJsonProvider {
}
}
@Override
public Object parse(Reader jsonReader) throws InvalidJsonException {
try {
return objectReader.readValue(jsonReader);
} catch (IOException e) {
throw new InvalidJsonException(e);
}
}
@Override
public Object parse(InputStream jsonStream) throws InvalidJsonException {
try {
@ -108,11 +96,6 @@ public class JacksonProvider extends AbstractJsonProvider {
}
}
@Override
public Map<String, Object> createMap() {
return new LinkedHashMap<String, Object>();
}
@Override
public List<Object> createArray() {
return new LinkedList<Object>();

14
json-path/src/main/java/com/jayway/jsonpath/internal/spi/json/JsonSmartJsonProvider.java

@ -25,7 +25,6 @@ import net.minidev.json.parser.ParseException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
import java.util.List;
import java.util.Map;
@ -43,10 +42,6 @@ public class JsonSmartJsonProvider extends AbstractJsonProvider {
this.mode = mode;
}
public Object createMap() {
return orderedMapper.createObject();
}
public Object createArray() {
return orderedMapper.createArray();
}
@ -59,15 +54,6 @@ public class JsonSmartJsonProvider extends AbstractJsonProvider {
}
}
@Override
public Object parse(Reader jsonReader) throws InvalidJsonException {
try {
return createParser().parse(jsonReader, orderedMapper);
} catch (ParseException e) {
throw new InvalidJsonException(e);
}
}
@Override
public Object parse(InputStream jsonStream) throws InvalidJsonException {
try {

5
json-path/src/main/java/com/jayway/jsonpath/spi/json/JsonProvider.java

@ -18,7 +18,6 @@ import com.jayway.jsonpath.InvalidJsonException;
import com.jayway.jsonpath.ValueCompareException;
import java.io.InputStream;
import java.io.Reader;
import java.util.Collection;
public interface JsonProvider {
@ -31,16 +30,12 @@ public interface JsonProvider {
Object parse(String json) throws InvalidJsonException;
Object parse(Reader jsonReader) throws InvalidJsonException;
Object parse(InputStream jsonStream) throws InvalidJsonException;
String toJson(Object obj);
Object createNull();
Object createMap();
Object createArray();
/**

Loading…
Cancel
Save