From c833b11b4edc51effd79e89cf86a03aed8215d59 Mon Sep 17 00:00:00 2001 From: Artem Getmanskii Date: Wed, 23 Jul 2025 23:49:29 +0300 Subject: [PATCH 1/3] add functions --- .../github/artemget/entrys/func/EBiFunc.java | 40 +++++++++++++++++++ .../io/github/artemget/entrys/func/EFunc.java | 39 ++++++++++++++++++ .../artemget/entrys/func/package-info.java | 28 +++++++++++++ 3 files changed, 107 insertions(+) create mode 100644 src/main/java/io/github/artemget/entrys/func/EBiFunc.java create mode 100644 src/main/java/io/github/artemget/entrys/func/EFunc.java create mode 100644 src/main/java/io/github/artemget/entrys/func/package-info.java diff --git a/src/main/java/io/github/artemget/entrys/func/EBiFunc.java b/src/main/java/io/github/artemget/entrys/func/EBiFunc.java new file mode 100644 index 0000000..63150cf --- /dev/null +++ b/src/main/java/io/github/artemget/entrys/func/EBiFunc.java @@ -0,0 +1,40 @@ +/* + * MIT License + * + * Copyright (c) 2024-2025. Artem Getmanskii + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +package io.github.artemget.entrys.func; + +import org.cactoos.BiFunc; + +/** + * Binary function with concrete entry exception. + * + * @param Type of input + * @param Type of input + * @param Type of output + * @since 0.4.2 + */ +public interface EBiFunc extends BiFunc { + @Override + Z apply(X first, Y second) throws Exception; +} diff --git a/src/main/java/io/github/artemget/entrys/func/EFunc.java b/src/main/java/io/github/artemget/entrys/func/EFunc.java new file mode 100644 index 0000000..645366b --- /dev/null +++ b/src/main/java/io/github/artemget/entrys/func/EFunc.java @@ -0,0 +1,39 @@ +/* + * MIT License + * + * Copyright (c) 2024-2025. Artem Getmanskii + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +package io.github.artemget.entrys.func; + +import org.cactoos.Func; + +/** + * Function with concrete entry exception. + * + * @param Type of input + * @param Type of output + * @since 0.4.2 + */ +public interface EFunc extends Func { + @Override + Y apply(X input) throws Exception; +} diff --git a/src/main/java/io/github/artemget/entrys/func/package-info.java b/src/main/java/io/github/artemget/entrys/func/package-info.java new file mode 100644 index 0000000..3e6f3a7 --- /dev/null +++ b/src/main/java/io/github/artemget/entrys/func/package-info.java @@ -0,0 +1,28 @@ +/* + * MIT License + * + * Copyright (c) 2024-2025. Artem Getmanskii + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +/** + * Entry functions. + */ +package io.github.artemget.entrys.func; From 39cbb16b32f382d8520f0da833a7635013797861 Mon Sep 17 00:00:00 2001 From: Artem Getmanskii Date: Wed, 23 Jul 2025 23:53:52 +0300 Subject: [PATCH 2/3] change yaml dep scope to provided --- README.md | 24 +++++++++++++++++++++++- pom.xml | 1 + 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 54f0fcf..2a6d8f4 100644 --- a/README.md +++ b/README.md @@ -22,9 +22,31 @@ This library is distributed via [jitpack.io](https://jitpack.io/#ArtemGet/entrys 1) Properties passed via -D 2) Environment variables -3) Json strings +3) Json strings + +Note that using json entries requires additional dependencies: + +```xml + + + org.glassfish + jakarta.json + 1.1.6 + +``` + 4) Yaml files +Note that using yaml entries requires additional dependencies: + +```xml + + com.amihaiemil.web + eo-yaml + 8.0.6 + +``` + # Examples ## Properties: diff --git a/pom.xml b/pom.xml index 12158d5..f0e9fcd 100644 --- a/pom.xml +++ b/pom.xml @@ -21,6 +21,7 @@ com.amihaiemil.web eo-yaml 8.0.6 + provided javax.json From acd0202f9eac97106d710ff1ca877e7ac429c6fe Mon Sep 17 00:00:00 2001 From: Artem Getmanskii Date: Wed, 23 Jul 2025 23:56:17 +0300 Subject: [PATCH 3/3] fix exceptions --- src/main/java/io/github/artemget/entrys/func/EBiFunc.java | 3 ++- src/main/java/io/github/artemget/entrys/func/EFunc.java | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/io/github/artemget/entrys/func/EBiFunc.java b/src/main/java/io/github/artemget/entrys/func/EBiFunc.java index 63150cf..6a97b2c 100644 --- a/src/main/java/io/github/artemget/entrys/func/EBiFunc.java +++ b/src/main/java/io/github/artemget/entrys/func/EBiFunc.java @@ -24,6 +24,7 @@ package io.github.artemget.entrys.func; +import io.github.artemget.entrys.EntryException; import org.cactoos.BiFunc; /** @@ -36,5 +37,5 @@ */ public interface EBiFunc extends BiFunc { @Override - Z apply(X first, Y second) throws Exception; + Z apply(X first, Y second) throws EntryException; } diff --git a/src/main/java/io/github/artemget/entrys/func/EFunc.java b/src/main/java/io/github/artemget/entrys/func/EFunc.java index 645366b..7a66e4b 100644 --- a/src/main/java/io/github/artemget/entrys/func/EFunc.java +++ b/src/main/java/io/github/artemget/entrys/func/EFunc.java @@ -24,6 +24,7 @@ package io.github.artemget.entrys.func; +import io.github.artemget.entrys.EntryException; import org.cactoos.Func; /** @@ -35,5 +36,5 @@ */ public interface EFunc extends Func { @Override - Y apply(X input) throws Exception; + Y apply(X input) throws EntryException; }