added Automatic-Module-Name to jar manifest and some utility methods
This commit is contained in:
@@ -27,6 +27,10 @@ javacOptions in (Compile, compile) ++= Seq("-target", "8", "-source", "8")
|
||||
libraryDependencies += "org.projectlombok" % "lombok" % "1.18.8" % Provided
|
||||
libraryDependencies += "net.woggioni" % "jwo" % "1.0" % Compile
|
||||
|
||||
Compile / packageBin / packageOptions +=
|
||||
Package.ManifestAttributes("Automatic-Module-Name" -> "net.woggioni.worth")
|
||||
|
||||
|
||||
val testDependencies = Seq("com.novocode" % "junit-interface" % "0.11" % Test,
|
||||
"com.fasterxml.jackson.core" % "jackson-databind" % "2.9.6" % Test,
|
||||
"org.tukaani" % "xz" % "1.8" % Test)
|
||||
|
@@ -3,11 +3,23 @@ package net.woggioni.worth.utils;
|
||||
import lombok.SneakyThrows;
|
||||
import net.woggioni.worth.xface.Value;
|
||||
|
||||
import java.util.Optional;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public class WorthUtils {
|
||||
|
||||
|
||||
public static Optional<Value> nested(Value root, String... keys) {
|
||||
Value result = root;
|
||||
for (String key : keys) {
|
||||
result = result.get(key);
|
||||
if (result == null) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return Optional.ofNullable(result);
|
||||
}
|
||||
|
||||
public static Value getOrNull(Value root, String... keys) {
|
||||
Value result = root;
|
||||
for (String key : keys) {
|
||||
|
@@ -18,6 +18,10 @@ public interface Value {
|
||||
|
||||
Type type();
|
||||
|
||||
default boolean isNull() {
|
||||
return type() == Value.Null.type();
|
||||
}
|
||||
|
||||
default boolean asBoolean() {
|
||||
throw new TypeException("Not a boolean");
|
||||
}
|
||||
|
Reference in New Issue
Block a user