Skip to content

Commit

Permalink
Rename API and bump version
Browse files Browse the repository at this point in the history
  • Loading branch information
wanglingsong committed Nov 12, 2015
1 parent e81904a commit b779b10
Show file tree
Hide file tree
Showing 7 changed files with 86 additions and 67 deletions.
2 changes: 1 addition & 1 deletion jsurfer-benchmark/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>jsurfer</artifactId>
<groupId>com.github.jsurfer</groupId>
<version>1.2.6</version>
<version>1.2.7</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down
2 changes: 1 addition & 1 deletion jsurfer-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>jsurfer</artifactId>
<groupId>com.github.jsurfer</groupId>
<version>1.2.6</version>
<version>1.2.7</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down
22 changes: 11 additions & 11 deletions jsurfer-core/src/main/java/org/jsfr/json/JsonSurfer.java
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,12 @@ public JsonSurfer(JsonParserAdapter jsonParserAdapter, JsonProvider jsonProvider
*
* @return SurfingConfiguration builder
*/
public SurfingConfiguration.Builder builder() {
public SurfingConfiguration.Builder configBuilder() {
return SurfingConfiguration.builder().withSurfer(this);
}

/**
* @param json json
* @param json json
* @param configuration SurfingConfiguration that holds JsonPath binding
*/
public void surf(String json, SurfingConfiguration configuration) {
Expand Down Expand Up @@ -129,10 +129,10 @@ public Collection<Object> collectAll(Reader reader, JsonPath... paths) {
}

/**
* @param json json
* @param json json
* @param tClass target class
* @param paths JsonPath
* @param <T> target class
* @param paths JsonPath
* @param <T> target class
* @return typed value
*/
public <T> Collection<T> collectAll(String json, Class<T> tClass, JsonPath... paths) {
Expand All @@ -150,7 +150,7 @@ public <T> Collection<T> collectAll(String json, Class<T> tClass, JsonPath... pa
*/
public <T> Collection<T> collectAll(Reader reader, Class<T> tClass, JsonPath... paths) {
CollectAllListener<T> listener = new CollectAllListener<T>(jsonProvider, tClass);
SurfingConfiguration.Builder builder = builder();
SurfingConfiguration.Builder builder = configBuilder();
for (JsonPath jsonPath : paths) {
builder.bind(jsonPath, listener);
}
Expand All @@ -159,10 +159,10 @@ public <T> Collection<T> collectAll(Reader reader, Class<T> tClass, JsonPath...
}

/**
* @param json json
* @param json json
* @param tClass target class
* @param paths JsonPath
* @param <T> target class
* @param paths JsonPath
* @param <T> target class
* @return typed value
*/
public <T> Collection<T> collectAll(String json, Class<T> tClass, String... paths) {
Expand Down Expand Up @@ -228,7 +228,7 @@ public <T> T collectOne(String json, Class<T> tClass, JsonPath... paths) {
@SuppressWarnings("unchecked")
public <T> T collectOne(Reader reader, Class<T> tClass, JsonPath... paths) {
CollectOneListener listener = new CollectOneListener(true);
SurfingConfiguration.Builder builder = builder().skipOverlappedPath();
SurfingConfiguration.Builder builder = configBuilder().skipOverlappedPath();
for (JsonPath jsonPath : paths) {
builder.bind(jsonPath, listener);
}
Expand All @@ -255,7 +255,7 @@ public <T> T collectOne(Reader reader, Class<T> tClass, String... paths) {
}

/**
* @param json json
* @param json json
* @param paths JsonPath
* @return value
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ public SurfingConfiguration build() {

/**
* Associated with a JsonSurfer
*
* @param jsonSurfer JsonSurfer
* @return builder
*/
Expand All @@ -110,17 +111,19 @@ public Builder withSurfer(JsonSurfer jsonSurfer) {

/**
* Build the configuration and then surf with it and the associated JsonSurfer
*
* @param json json
*/
public void surf(String json) {
this.surf(this.jsonSurfer.read(json));
public void buildAndSurf(String json) {
this.buildAndSurf(this.jsonSurfer.read(json));
}

/**
* Build the configuration and then surf with it and the associated JsonSurfer
*
* @param jsonReader jsonReader
*/
public void surf(Reader jsonReader) {
public void buildAndSurf(Reader jsonReader) {
this.jsonSurfer.surf(jsonReader, this.build());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ public boolean endObject() {
if (stopped) {
return false;
}
this.currentKey = null;
currentPosition.stepOutObject();
dispatcher.endObject();
return true;
Expand Down
Loading

0 comments on commit b779b10

Please sign in to comment.