Skip to content

Json 20 json api #27

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .idea/codeStyles/Project.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/codeStyles/codeStyleConfig.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 0 additions & 5 deletions .idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public <V, T> JsonValue<V> newValue(T value, JsonElement parent) {
@SuppressWarnings("unchecked")
private <V, T> JsonValue<V> mapToValue(T value) {
if (mapperProviderAvailable) {
return (JsonValue<V>) mapperFactory.newBuilder().build().toValue(value);
return (JsonValue<V>) mapperFactory.newMapper().toValue(value);
} else {
throwUnsupportedError(value.getClass());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ public boolean equals(Object o) {
if (!(o instanceof JsonArrayImpl jsonArray)) {
return false;
}

return Objects.equals(valueList, jsonArray.valueList);
}

Expand Down Expand Up @@ -183,6 +183,11 @@ public String prettyPrint(int indent) {
return builder.toString();
}

@Override
public int hashCode() {
return Objects.hash(this.valueList);
}

public String toString() {
return toJsonString();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ public boolean equals(Object o) {

@Override
public int hashCode() {
return Objects.hash(data, parent());
return Objects.hash(data);
}

@Override
Expand Down
5 changes: 5 additions & 0 deletions json-api/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# JSON API

The Json API combines all the reference implementation services into a single API layer for use as single library.

Each "service" is exposed as static class instances that expose methods provided by that service.
62 changes: 62 additions & 0 deletions json-api/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<?xml version="1.0" encoding="UTF-8"?>
<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">
<parent>
<artifactId>json-library</artifactId>
<groupId>io.github.xmljim.json</groupId>
<version>1.0.2</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>json-api</artifactId>


<dependencies>
<dependency>
<groupId>io.github.xmljim.json</groupId>
<artifactId>json-parser</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.github.xmljim.json</groupId>
<artifactId>elementfactory</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.github.xmljim.json</groupId>
<artifactId>json-merger</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.github.xmljim.json</groupId>
<artifactId>json-mapper</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.github.xmljim.json</groupId>
<artifactId>jsonpath</artifactId>
<version>${project.version}</version>
<scope>compile</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<executions>
<execution>
<id>report</id>
<phase>verify</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

</project>
Loading