-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move jsonpath to its own module (#342)
* Move jsonpath to its own module * cleanup
- Loading branch information
Showing
33 changed files
with
212 additions
and
123 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
plugins { | ||
id 'java-library' | ||
id 'java-test-fixtures' | ||
} | ||
|
||
dependencies { | ||
api project(":logging") | ||
|
||
// https://mvnrepository.com/artifact/com.jayway.jsonpath/json-path | ||
implementation "com.jayway.jsonpath:json-path:$jsonPathVersion" | ||
|
||
testImplementation(testFixtures(project(':logging'))) | ||
} |
13 changes: 9 additions & 4 deletions
13
...a/logging/spi/AbstractJsonPathFinder.java → ...axia/jsonpath/AbstractJsonPathFinder.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ogging/spi/EchopraxiaMappingProvider.java → ...a/jsonpath/EchopraxiaMappingProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...hopraxia/logging/spi/FindPathMethods.java → .../echopraxia/jsonpath/FindPathMethods.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package echopraxia.logging.spi; | ||
package echopraxia.jsonpath; | ||
|
||
import java.util.List; | ||
import java.util.Map; | ||
|
37 changes: 37 additions & 0 deletions
37
jsonpath/src/main/java/echopraxia/jsonpath/JsonPathCondition.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package echopraxia.jsonpath; | ||
|
||
import echopraxia.logging.api.Condition; | ||
import echopraxia.logging.api.Level; | ||
import java.util.function.BiFunction; | ||
import java.util.function.Function; | ||
import org.jetbrains.annotations.Contract; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
public class JsonPathCondition { | ||
|
||
@Contract(pure = true) | ||
public static @NotNull Condition pathCondition( | ||
Function<LoggingContextWithFindPathMethods, Boolean> o) { | ||
return (level, context) -> { | ||
if (context instanceof LoggingContextWithFindPathMethods) { | ||
return o.apply((LoggingContextWithFindPathMethods) context); | ||
} else { | ||
throw new IllegalStateException( | ||
"pathCondition requires LoggingContextWithFindPathMethods instance!"); | ||
} | ||
}; | ||
} | ||
|
||
@Contract(pure = true) | ||
public static @NotNull Condition pathCondition( | ||
BiFunction<Level, LoggingContextWithFindPathMethods, Boolean> o) { | ||
return (level, context) -> { | ||
if (context instanceof LoggingContextWithFindPathMethods) { | ||
return o.apply(level, (LoggingContextWithFindPathMethods) context); | ||
} else { | ||
throw new IllegalStateException( | ||
"pathCondition requires LoggingContextWithFindPathMethods instance!"); | ||
} | ||
}; | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
jsonpath/src/main/java/echopraxia/jsonpath/LoggingContextWithFindPathMethods.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package echopraxia.jsonpath; | ||
|
||
import echopraxia.logging.api.LoggingContext; | ||
|
||
public interface LoggingContextWithFindPathMethods extends LoggingContext, FindPathMethods {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.