Skip to content
This repository was archived by the owner on Oct 31, 2024. It is now read-only.

Commit b3079ca

Browse files
committed
Merge branch 'cleanup-pr32'
2 parents 7a9694b + 86be154 commit b3079ca

File tree

6 files changed

+214
-219
lines changed

6 files changed

+214
-219
lines changed

.gitignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
/tmp
22
/target
3-
/jmespath-core/target
4-
/jmespath-jackson/target
3+
/jmespath-*/target
54
.classpath
65
.project
76
.settings

README.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
_If you're reading this on GitHub, please note that this is the readme for the development version and that some features described here might not yet have been released. You can find the readme for a specific version via the release tags ([here is an example](https://github.com/burtcorp/jmespath-java/releases/tag/jmespath-0.1.0))._
66

7-
This is an implementation of [JMESPath](http://jmespath.org/) for Java and it supports searching JSON documents (via Jackson) and structures containing basic Java objects (`Map`, `List`, `String`, etc.) – but can also be extended to work with any JSON-like structure.
7+
This is an implementation of [JMESPath](http://jmespath.org/) for Java and it supports searching JSON documents (via [Jackson](https://github.com/FasterXML/jackson) or [Gson](https://github.com/google/gson)) and structures containing basic Java objects (`Map`, `List`, `String`, etc.) – but can also be extended to work with any JSON-like structure.
88

99
## Installation
1010

@@ -20,14 +20,16 @@ Using Maven you can add this to your dependencies:
2020

2121
Check the [releases page](https://github.com/burtcorp/jmespath-java/releases) for the value of `${jmespath.version}`.
2222

23-
If you don't want the Jackson implementation you can change the `artifactId` to `jmespath-core`, and if you specifically want to depend only on the Jackson implementation (if we release other implementations in the future) you can change it to `jmespath-jackson`.
23+
If you don't want both the Jackson and Gson implementations you can change it to `jmespath-jackson` or `jmespath-gson`.
2424

2525
### Dependencies
2626

2727
`jmespath-core` has an ANTLR based parser, but the ANTLR runtime artifact has been shaded into the `io.burt.jmespath` package to avoid conflicts with other artifacts that may depend on ANTLR. This means that `jmespath-core` has no external dependencies.
2828

2929
`jmespath-jackson` obviously depends on Jackson, specifically Jackson DataBind (`com.fasterxml.jackson.core:jackson-databind`), but other than that it only depends on `jmespath-core`.
3030

31+
`jmespath-gson` depends on GSON, specifically `com.google.code.gson:gson`, but other than that only `jmespath-core`.
32+
3133
## Basic usage
3234

3335
```java
@@ -57,7 +59,7 @@ JsonNode result = expression.search(input);
5759

5860
## Description
5961

60-
`jmespath-java` comes in two parts: `jmespath-core` and `jmespath-jackson`. The former contains the expression parser, core runtime, default functions and a simple runtime adapter that can search structures made up from numbers, strings, booleans, `List` and `Map` available as `io.burt.jmespath.jcf.JcfRuntime` (for "Java Collections Framework"). The latter contains the Jackson runtime adapter, and is what you should be using most of the time. The JCF runtime is just for internal development and testing. It primarily exists to test that there's nothing runtime-specific in the implementation.
62+
`jmespath-java` comes in three parts: `jmespath-core`, `jmespath-jackson`, and `jmespath-gson`. The former contains the expression parser, core runtime, default functions and a simple runtime adapter that can search structures made up from numbers, strings, booleans, `List` and `Map` available as `io.burt.jmespath.jcf.JcfRuntime` (for "Java Collections Framework"). The latter contains the Jackson and GSON runtime adapters, respectively, and is what you should be using most of the time. The JCF runtime is just for internal development and testing. It primarily exists to test that there's nothing runtime-specific in the implementation.
6163

6264
## Extensions
6365

@@ -134,7 +136,7 @@ Creating a runtime adapter is a bit more work than adding a function, but not ex
134136

135137
Most of the work a runtime does is converting back and forth between Java types. The core runtime can't know about all of the types of structures you want to search, but it knows that they will be JSON-like, so it uses the runtime adapters to help translate. The Jackson runtime adapter, for example, translates the world of `JsonNode`s into Java types like `List` and `String` when asked by the core runtime.
136138

137-
Runtime adapters can wrap libraries like [Gson](https://github.com/google/gson), but can also make it possible, for example, to search Java beans with JMESPath by translating JMESPath operations to reflection calls. The structure to search doesn't have to be JSON, it just has to be JSON-_like_.
139+
Runtime adapters can wrap libraries like [Jackson](https://github.com/FasterXML/jackson) and [Gson](https://github.com/google/gson), but can also make it possible, for example, to search Java beans with JMESPath by translating JMESPath operations to reflection calls. The structure to search doesn't have to be JSON, it just has to be JSON-_like_.
138140

139141
A good starting point for writing a new runtime adapter is reading the code of the existing adapters and the docs for `Adapter` and `BaseAdapter`. There are also JUnit tests in `JmesPathRuntimeTest` and `JmesPathComplianceTest` that can be subclassed and run against any runtime.
140142

@@ -151,4 +153,4 @@ And all dependencies should be installed, the code compiled and the tests run.
151153

152154
# Copyright
153155

154-
© 2016 Burt AB, see LICENSE.txt (BSD 3-Clause).
156+
© 2016-2018 Burt AB, see LICENSE.txt (BSD 3-Clause).

jmespath-gson/pom.xml

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,35 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<project xmlns="http://maven.apache.org/POM/4.0.0"
3-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4-
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5-
<parent>
6-
<artifactId>jmespath</artifactId>
7-
<groupId>io.burt</groupId>
8-
<version>0.2.1-SNAPSHOT</version>
9-
</parent>
10-
<modelVersion>4.0.0</modelVersion>
112

12-
<artifactId>jmespath-gson</artifactId>
3+
<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/xsd/maven-4.0.0.xsd">
4+
<modelVersion>4.0.0</modelVersion>
135

14-
<dependencies>
15-
<dependency>
16-
<groupId>${project.groupId}</groupId>
17-
<artifactId>jmespath-core</artifactId>
18-
<version>${project.parent.version}</version>
19-
</dependency>
20-
<dependency>
21-
<groupId>${project.groupId}</groupId>
22-
<artifactId>jmespath-core</artifactId>
23-
<version>${project.parent.version}</version>
24-
<type>test-jar</type>
25-
<scope>test</scope>
26-
</dependency>
27-
<!-- https://mvnrepository.com/artifact/com.google.code.gson/gson -->
28-
<dependency>
29-
<groupId>com.google.code.gson</groupId>
30-
<artifactId>gson</artifactId>
31-
<version>2.8.2</version>
32-
</dependency>
33-
</dependencies>
6+
<artifactId>jmespath-gson</artifactId>
7+
<name>JMESPath GSON</name>
8+
<description>A JMESPath implementation for Java</description>
349

35-
</project>
10+
<parent>
11+
<groupId>io.burt</groupId>
12+
<artifactId>jmespath</artifactId>
13+
<version>0.2.1-SNAPSHOT</version>
14+
</parent>
15+
16+
<dependencies>
17+
<dependency>
18+
<groupId>${project.groupId}</groupId>
19+
<artifactId>jmespath-core</artifactId>
20+
<version>${project.parent.version}</version>
21+
</dependency>
22+
<dependency>
23+
<groupId>${project.groupId}</groupId>
24+
<artifactId>jmespath-core</artifactId>
25+
<version>${project.parent.version}</version>
26+
<type>test-jar</type>
27+
<scope>test</scope>
28+
</dependency>
29+
<dependency>
30+
<groupId>com.google.code.gson</groupId>
31+
<artifactId>gson</artifactId>
32+
<version>${gson.version}</version>
33+
</dependency>
34+
</dependencies>
35+
</project>

0 commit comments

Comments
 (0)