Browse Source

Fixed backward compatibility in JsonModel.

pull/8/merge
Kalle Stenflo 13 years ago
parent
commit
fb9cc8dfe2
  1. 1
      json-path/pom.xml
  2. 12
      json-path/src/main/java/com/jayway/jsonpath/JsonModel.java
  3. 6
      json-path/src/test/java/com/jayway/jsonpath/IssuesTest.java
  4. 11
      pom.xml

1
json-path/pom.xml

@ -69,6 +69,7 @@
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>2.3.7</version>
<extensions>true</extensions>
</plugin>
</plugins>

12
json-path/src/main/java/com/jayway/jsonpath/JsonModel.java

@ -488,6 +488,9 @@ public class JsonModel {
return new JsonModel(json, JsonProviderFactory.createProvider());
}
public static JsonModel create(String json) {
return model(json);
}
/**
* Creates a JsonModel
@ -500,6 +503,9 @@ public class JsonModel {
return new JsonModel(jsonObject, JsonProviderFactory.createProvider());
}
public static JsonModel create(Object jsonObject) {
return model(jsonObject);
}
/**
* Creates a JsonModel
@ -512,6 +518,9 @@ public class JsonModel {
return new JsonModel(url, JsonProviderFactory.createProvider());
}
public static JsonModel create(URL url) throws IOException {
return model(url);
}
/**
* Creates a JsonModel
@ -524,6 +533,9 @@ public class JsonModel {
return new JsonModel(jsonInputStream, JsonProviderFactory.createProvider());
}
public static JsonModel create(InputStream jsonInputStream) throws IOException {
return model(jsonInputStream);
}
// --------------------------------------------------------
//

6
json-path/src/test/java/com/jayway/jsonpath/IssuesTest.java

@ -23,5 +23,11 @@ public class IssuesTest {
assertNull(JsonPath.read(json, "$.foo.id"));
}
@Test
public void issue_11() throws Exception {
//String json = "{ \"foo\" : [] }";
//JsonPath.read(json, "$.foo[?(@.rel= 'item')][0].uri");
}
}

11
pom.xml

@ -14,7 +14,8 @@
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.sonatype.oss</groupId>
@ -31,7 +32,7 @@
<inceptionYear>2011</inceptionYear>
<issueManagement>
<system>GitHub Issue Tracking</system>
<url />
<url/>
</issueManagement>
<licenses>
<license>
@ -75,8 +76,8 @@
</modules>
<build>
<pluginManagement>
<plugins>
<pluginManagement>
<plugins>
<!--
<plugin>
<groupId>org.eclipse.m2e</groupId>
@ -104,7 +105,7 @@
</configuration>
</plugin>
-->
</plugins>
</plugins>
</pluginManagement>
<plugins>
<plugin>

Loading…
Cancel
Save