Package eu.dnetlib.validator2.engine
Class Helper
java.lang.Object
eu.dnetlib.validator2.engine.Helper
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Builders.ElementSpecBuilderaddAttribute(Builders.ElementSpecBuilder builder, String attrName, eu.dnetlib.validator2.result_models.RequirementLevel requirementLevel) static Builders.ElementSpecBuilderbuildElement(String elementName, eu.dnetlib.validator2.result_models.RequirementLevel requirementLevel, Cardinality cardinality) static Stringstatic TestResultPredicate<Integer>createCardinalityPredicate(long min, long max, boolean isInclusive) static StringensureNonEmpty(String value, String errorMessage) static StringensureNonEmpty(String value, Supplier<? extends RuntimeException> exceptionSupplier) static StringensurePropertyIsPresent(String propertyName, Supplier<String> propertySupplier) static voidforEachZipEntry(File zipFile, int bufferSize, Predicate<ZipEntry> filter, BiConsumer<String, InputStream> zipEntryConsumer) static StringgetAttributeValue(Node node, String attrName) static booleanstatic <T> NodeListnodesThatMatchThePredicate(NodeList nodes, Function<Node, T> nodeReader, Predicate<T> predicate) static <T> RuleValidationResultpredicateFailsForAllNodes(NodeList nodes, Function<Node, T> nodeReader, TestResultPredicate<T> predicate) static <T> RuleValidationResultpredicateSucceedsForAllNodes(NodeList nodes, Function<Node, T> nodeReader, TestResultPredicate<T> predicate) static <T> RuleValidationResultpredicateSucceedsForAtLeastOneNode(NodeList nodes, Function<Node, T> nodeReader, TestResultPredicate<T> predicate) static <T> RuleValidationResultpredicateSucceedsForExactlyOneNode(NodeList nodes, Function<Node, T> nodeReader, TestResultPredicate<T> predicate) static StringreadPropertyAndErrIfNotFound(String propertyName, Map<String, String> map) static String
-
Field Details
-
ZIP_ENTRY_IS_FILE
-
-
Constructor Details
-
Helper
public Helper()
-
-
Method Details
-
isEmpty
-
ensurePropertyIsPresent
-
readPropertyAndErrIfNotFound
-
ensureNonEmpty
-
ensureNonEmpty
public static String ensureNonEmpty(String value, Supplier<? extends RuntimeException> exceptionSupplier) -
canonicalize
-
stringify
-
predicateSucceedsForAllNodes
public static <T> RuleValidationResult predicateSucceedsForAllNodes(NodeList nodes, Function<Node, T> nodeReader, TestResultPredicate<T> predicate) -
predicateSucceedsForAtLeastOneNode
public static <T> RuleValidationResult predicateSucceedsForAtLeastOneNode(NodeList nodes, Function<Node, T> nodeReader, TestResultPredicate<T> predicate) -
predicateFailsForAllNodes
public static <T> RuleValidationResult predicateFailsForAllNodes(NodeList nodes, Function<Node, T> nodeReader, TestResultPredicate<T> predicate) -
predicateSucceedsForExactlyOneNode
public static <T> RuleValidationResult predicateSucceedsForExactlyOneNode(NodeList nodes, Function<Node, T> nodeReader, TestResultPredicate<T> predicate) -
nodesThatMatchThePredicate
-
getAttributeValue
-
createCardinalityPredicate
public static TestResultPredicate<Integer> createCardinalityPredicate(long min, long max, boolean isInclusive) -
buildElement
public static Builders.ElementSpecBuilder buildElement(String elementName, eu.dnetlib.validator2.result_models.RequirementLevel requirementLevel, Cardinality cardinality) -
addAttribute
public static Builders.ElementSpecBuilder addAttribute(Builders.ElementSpecBuilder builder, String attrName, eu.dnetlib.validator2.result_models.RequirementLevel requirementLevel) -
forEachZipEntry
public static void forEachZipEntry(File zipFile, int bufferSize, Predicate<ZipEntry> filter, BiConsumer<String, InputStream> zipEntryConsumer) throws IOException- Throws:
IOException
-