add validation, trie
This commit is contained in:
parent
78835f875b
commit
58a7fc964c
464 changed files with 61053 additions and 0 deletions
|
@ -0,0 +1,43 @@
|
|||
package org.xbib.datastructures.trie;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class Node<T> {
|
||||
|
||||
private Character key;
|
||||
|
||||
private T value;
|
||||
|
||||
private boolean terminal;
|
||||
|
||||
private final Map<Character, Node<T>> children = new HashMap<>();
|
||||
|
||||
public Character getKey() {
|
||||
return key;
|
||||
}
|
||||
|
||||
public void setKey(Character key) {
|
||||
this.key = key;
|
||||
}
|
||||
|
||||
public T getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(T value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public boolean isTerminal() {
|
||||
return terminal;
|
||||
}
|
||||
|
||||
public void setTerminal(boolean terminal) {
|
||||
this.terminal = terminal;
|
||||
}
|
||||
|
||||
public Map<Character, Node<T>> getChildren() {
|
||||
return children;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
package org.xbib.datastructures.trie;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* https://stevedaskam.wordpress.com/2009/05/28/trie-structures/
|
||||
*
|
||||
* @param <T>
|
||||
*/
|
||||
public interface Trie<T> {
|
||||
|
||||
void add(String key, T value);
|
||||
|
||||
T search(String key);
|
||||
|
||||
List<T> startsWith(String prefix);
|
||||
|
||||
boolean contains(String key);
|
||||
|
||||
Set<String> getAllKeys();
|
||||
|
||||
int size();
|
||||
}
|
|
@ -0,0 +1,127 @@
|
|||
package org.xbib.datastructures.trie;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
public class TrieImpl<T> implements Trie<T> {
|
||||
|
||||
private final Node<T> node = new Node<>();
|
||||
|
||||
@Override
|
||||
public void add(String key, T value) {
|
||||
addNode(node, key, 0, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public T search(String key) {
|
||||
return findKey(node, key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<T> startsWith(String prefix) {
|
||||
List<T> list = new ArrayList<>();
|
||||
Node<T> node = this.node;
|
||||
for (char c : prefix.toCharArray()) {
|
||||
node = node.getChildren().get(c);
|
||||
if (node == null) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (node != null) {
|
||||
getValues(node, list);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean contains(String key) {
|
||||
return hasKey(node, key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<String> getAllKeys() {
|
||||
Set<String> keySet = new HashSet<>();
|
||||
getKeys(node, "", keySet);
|
||||
return keySet;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int size() {
|
||||
return getAllKeys().size();
|
||||
}
|
||||
|
||||
private void getValues(Node<T> currNode, List<T> valueList) {
|
||||
if (currNode.isTerminal()) {
|
||||
valueList.add(currNode.getValue());
|
||||
}
|
||||
Map<Character, Node<T>> children = currNode.getChildren();
|
||||
for (Map.Entry<Character, Node<T>> entry : children.entrySet()) {
|
||||
getValues(entry.getValue(), valueList);
|
||||
}
|
||||
}
|
||||
|
||||
private void getKeys(Node<T> currNode, String key, Set<String> keySet) {
|
||||
if (currNode.isTerminal()) {
|
||||
keySet.add(key);
|
||||
}
|
||||
Map<Character, Node<T>> children = currNode.getChildren();
|
||||
for (Map.Entry<Character, Node<T>> entry : children.entrySet()) {
|
||||
String s = key + entry.getValue().getKey();
|
||||
getKeys(entry.getValue(), s, keySet);
|
||||
}
|
||||
}
|
||||
|
||||
private T findKey(Node<T> currNode, String key) {
|
||||
char ch = key.length() > 0 ? key.charAt(0) : '\0';
|
||||
if (currNode.getChildren().containsKey(ch)) {
|
||||
Node<T> nextNode = currNode.getChildren().get(ch);
|
||||
if (key.length() <= 1) {
|
||||
if (nextNode.isTerminal()) {
|
||||
return nextNode.getValue();
|
||||
}
|
||||
} else {
|
||||
return findKey(nextNode, key.substring(1));
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private boolean hasKey(Node<T> currNode, String key) {
|
||||
char c = key.length() > 0 ? key.charAt(0) : '\0';
|
||||
if (currNode.getChildren().containsKey(c)) {
|
||||
Node<T> nextNode = currNode.getChildren().get(c);
|
||||
if (key.length() <= 1) {
|
||||
return nextNode.isTerminal();
|
||||
} else {
|
||||
return hasKey(nextNode, key.substring(1));
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private void addNode(Node<T> currNode, String key, int pos, T value) {
|
||||
Character c = pos < key.length() ? key.charAt(pos) : '\0';
|
||||
Node<T> nextNode = currNode.getChildren().get(c);
|
||||
if (nextNode == null) {
|
||||
nextNode = new Node<>();
|
||||
nextNode.setKey(c);
|
||||
if (pos < key.length() - 1) {
|
||||
addNode(nextNode, key, pos + 1, value);
|
||||
} else {
|
||||
nextNode.setValue(value);
|
||||
nextNode.setTerminal(true);
|
||||
}
|
||||
currNode.getChildren().put(c, nextNode);
|
||||
} else {
|
||||
if (pos < key.length() - 1) {
|
||||
addNode(nextNode, key, pos + 1, value);
|
||||
} else {
|
||||
nextNode.setValue(value);
|
||||
nextNode.setTerminal(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
package org.xbib.datastructures.trie.compact;
|
||||
|
||||
class Node {
|
||||
|
||||
boolean isLeaf;
|
||||
|
||||
char[] value;
|
||||
Node[] children;
|
||||
|
||||
// temp variable, carrying information about potential mismatch used for inserting
|
||||
int divergeKeyIndex;
|
||||
int divergePatternIndex;
|
||||
|
||||
Node copyNode(char[] value) {
|
||||
Node node = new Node();
|
||||
node.value = value;
|
||||
node.isLeaf = this.isLeaf;
|
||||
node.children = this.children;
|
||||
return node;
|
||||
}
|
||||
|
||||
static Node innerNode(char[] value) {
|
||||
Node node = new Node();
|
||||
node.isLeaf = false;
|
||||
node.value = value;
|
||||
node.children = new Node[26];
|
||||
return node;
|
||||
}
|
||||
|
||||
static Node leafNode(char[] value) {
|
||||
Node node = new Node();
|
||||
node.isLeaf = true;
|
||||
node.value = value;
|
||||
node.children = new Node[26];
|
||||
return node;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,115 @@
|
|||
package org.xbib.datastructures.trie.compact;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* https://leetcode.com/problems/implement-trie-prefix-tree/discuss/467046/Java-Radix-tree-(compact-prefix-tree)-beats-99.7-runtime-and-100-memory
|
||||
*/
|
||||
|
||||
public class Trie {
|
||||
|
||||
private static int indexOf(char c) {
|
||||
return c - 'a';
|
||||
}
|
||||
|
||||
private final Node root;
|
||||
|
||||
public Trie() {
|
||||
root = Node.innerNode(new char[0]);
|
||||
}
|
||||
|
||||
public void insert(String word) {
|
||||
char[] key = word.toCharArray();
|
||||
Node lastNode = search(root, key, 0);
|
||||
if (lastNode.divergeKeyIndex == key.length) {
|
||||
if (lastNode.divergePatternIndex == lastNode.value.length) {
|
||||
lastNode.isLeaf = true;
|
||||
} else {// we need to reduce length of the compressed pattern in the current node,
|
||||
// make it node leaf, and create child that carry over the original children/isLeaf
|
||||
char[] childValue = Arrays.copyOfRange(lastNode.value,
|
||||
lastNode.divergePatternIndex, lastNode.value.length);
|
||||
Node childNode = lastNode.copyNode(childValue);
|
||||
lastNode.value = Arrays.copyOfRange(lastNode.value,
|
||||
0, lastNode.divergePatternIndex);
|
||||
lastNode.isLeaf = true;
|
||||
lastNode.children = new Node[26];
|
||||
lastNode.children[indexOf(childValue[0])] = childNode;
|
||||
}
|
||||
} else {
|
||||
if (lastNode.divergePatternIndex < lastNode.value.length) {// If diverge happens in middle of both array
|
||||
// we need to reduce length of the compressed pattern in the current node
|
||||
// create one leaf node for the new key, one child that carry over the original children/isLeaf
|
||||
Node newLeaf = Node.leafNode(Arrays.copyOfRange(key, lastNode.divergeKeyIndex, key.length));
|
||||
Node newChild = lastNode.copyNode(Arrays.copyOfRange(lastNode.value,
|
||||
lastNode.divergePatternIndex, lastNode.value.length));
|
||||
lastNode.children = new Node[26];
|
||||
lastNode.children[indexOf(newLeaf.value[0])] = newLeaf;
|
||||
lastNode.children[indexOf(newChild.value[0])] = newChild;
|
||||
lastNode.isLeaf = false;
|
||||
lastNode.value = Arrays.copyOfRange(lastNode.value, 0, lastNode.divergePatternIndex);
|
||||
} else { // pattern is shorter than the key
|
||||
// we need to create a left node for the new key, and append it to the original ndoe
|
||||
Node newLeaf = Node.leafNode(Arrays.copyOfRange(key, lastNode.divergeKeyIndex, key.length));
|
||||
lastNode.children[indexOf(newLeaf.value[0])] = newLeaf;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Returns if the word is in the trie. */
|
||||
public boolean search(String word) {
|
||||
char[] key = word.toCharArray();
|
||||
Node lastNode = search(root, key, 0);
|
||||
// if we run out of key and pattern, and node is leaf, then key exists
|
||||
return lastNode.divergeKeyIndex == key.length &&
|
||||
lastNode.divergePatternIndex == lastNode.value.length &&
|
||||
lastNode.isLeaf;
|
||||
}
|
||||
|
||||
/** Returns if there is any word in the trie that starts with the given prefix. */
|
||||
public boolean startsWith(String prefix) {
|
||||
char[] key = prefix.toCharArray();
|
||||
Node lastNode = search(root, key, 0);
|
||||
// if we run out of key, than prefix exists
|
||||
return lastNode.divergeKeyIndex == key.length;
|
||||
}
|
||||
|
||||
// Return the last node in the search path
|
||||
private Node search(Node node, char[] key, int begin) {
|
||||
int patternMismatchIndex = compare(key, begin, node.value);
|
||||
int divergeKeyIndex = patternMismatchIndex + begin;
|
||||
|
||||
if (divergeKeyIndex >= key.length) {// If we run out of keys (could be match or prefix)
|
||||
node.divergeKeyIndex = divergeKeyIndex;
|
||||
node.divergePatternIndex = patternMismatchIndex;
|
||||
return node;
|
||||
} else {
|
||||
if (patternMismatchIndex >= node.value.length) {// if we run out of values(continue search child)
|
||||
Node nextNode = node.children[indexOf(key[divergeKeyIndex])];
|
||||
if (nextNode == null) { // we've reach the end
|
||||
node.divergeKeyIndex = divergeKeyIndex;
|
||||
node.divergePatternIndex = patternMismatchIndex;
|
||||
return node;
|
||||
} else {
|
||||
return search(nextNode, key, divergeKeyIndex);
|
||||
}
|
||||
} else {// if mismatch happens in the middle of pattern
|
||||
node.divergeKeyIndex = divergeKeyIndex;
|
||||
node.divergePatternIndex = patternMismatchIndex;
|
||||
return node;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static int compare(char[] src, int begin, char[] pattern) {
|
||||
int srcIndex = begin;
|
||||
int patternIndex = 0;
|
||||
while (srcIndex < src.length && patternIndex < pattern.length) {
|
||||
if (src[srcIndex] != pattern[srcIndex - begin]) {
|
||||
break; // src and pattern diverges
|
||||
}
|
||||
srcIndex ++;
|
||||
patternIndex ++;
|
||||
}
|
||||
return patternIndex;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,44 @@
|
|||
package org.xbib.datastructures.trie.limewire;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.NoSuchElementException;
|
||||
|
||||
|
||||
/**
|
||||
* Provides an unmodifiable empty iterator. <code>EmptyIterator</code> always
|
||||
* returns that there aren't any more items and throws a
|
||||
* {@link NoSuchElementException} when attempting to move to the next item.
|
||||
*
|
||||
* <pre>
|
||||
* try{
|
||||
* EmptyIterator ei = new EmptyIterator();
|
||||
* ei.next();
|
||||
* } catch (Exception e) {
|
||||
* System.out.println("Expected to get NoSuchElementException exception: " + e.toString());
|
||||
* }
|
||||
*
|
||||
* Output:
|
||||
* Expected to get NoSuchElementException exception: java.util.NoSuchElementException
|
||||
* </pre>
|
||||
*/
|
||||
public class EmptyIterator extends UnmodifiableIterator {
|
||||
/**
|
||||
* A constant EmptyIterator.
|
||||
*/
|
||||
public final static Iterator EMPTY_ITERATOR = new EmptyIterator();
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public static <T> Iterator<T> emptyIterator() {
|
||||
return EMPTY_ITERATOR;
|
||||
}
|
||||
|
||||
// inherits javadoc comment
|
||||
public boolean hasNext() {
|
||||
return false;
|
||||
}
|
||||
|
||||
// inherits javadoc comment
|
||||
public Object next() {
|
||||
throw new NoSuchElementException();
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load diff
|
@ -0,0 +1,157 @@
|
|||
package org.xbib.datastructures.trie.limewire;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.SortedMap;
|
||||
|
||||
/**
|
||||
* Defines the interface for a prefix tree, an ordered tree data structure. For
|
||||
* more information, see <a href= "http://en.wikipedia.org/wiki/Trie">Tries</a>.
|
||||
*
|
||||
* @author Roger Kapsi
|
||||
* @author Sam Berlin
|
||||
*/
|
||||
public interface Trie<K, V> extends SortedMap<K, V> {
|
||||
|
||||
/**
|
||||
* Returns a view of this Trie of all elements that are
|
||||
* prefixed by the given key.
|
||||
* <p>
|
||||
* In a fixed-keysize Trie, this is essentially a 'get' operation.
|
||||
* <p>
|
||||
* For example, if the Trie contains 'Lime', 'LimeWire',
|
||||
* 'LimeRadio', 'Lax', 'Later', 'Lake', and 'Lovely', then
|
||||
* a lookup of 'Lime' would return 'Lime', 'LimeRadio', and 'LimeWire'.
|
||||
*/
|
||||
SortedMap<K, V> getPrefixedBy(K key);
|
||||
|
||||
/**
|
||||
* Returns a view of this Trie of all elements that are
|
||||
* prefixed by the length of the key.
|
||||
* <p>
|
||||
* Fixed-keysize Tries will not support this operation
|
||||
* (because all keys will be the same length).
|
||||
* <p>
|
||||
* For example, if the Trie contains 'Lime', 'LimeWire',
|
||||
* 'LimeRadio', 'Lax', 'Later', 'Lake', and 'Lovely', then
|
||||
* a lookup of 'LimePlastics' with a length of 4 would
|
||||
* return 'Lime', 'LimeRadio', and 'LimeWire'.
|
||||
*/
|
||||
SortedMap<K, V> getPrefixedBy(K key, int length);
|
||||
|
||||
/**
|
||||
* Returns a view of this Trie of all elements that are prefixed
|
||||
* by the key, starting at the given offset and for the given length.
|
||||
* <p>
|
||||
* Fixed-keysize Tries will not support this operation
|
||||
* (because all keys are the same length).
|
||||
* <p>
|
||||
* For example, if the Trie contains 'Lime', 'LimeWire',
|
||||
* 'LimeRadio', 'Lax', 'Later', 'Lake', and 'Lovely', then
|
||||
* a lookup of 'The Lime Plastics' with an offset of 4 and a
|
||||
* length of 4 would return 'Lime', 'LimeRadio', and 'LimeWire'.
|
||||
*/
|
||||
SortedMap<K, V> getPrefixedBy(K key, int offset, int length);
|
||||
|
||||
/**
|
||||
* Returns a view of this Trie of all elements that are prefixed
|
||||
* by the number of bits in the given Key.
|
||||
* <p>
|
||||
* Fixed-keysize Tries can support this operation as a way to do
|
||||
* lookups of partial keys. That is, if the Trie is storing IP
|
||||
* addresses, you can lookup all addresses that begin with
|
||||
* '192.168' by providing the key '192.168.X.X' and a length of 16
|
||||
* would return all addresses that begin with '192.168'.
|
||||
*/
|
||||
SortedMap<K, V> getPrefixedByBits(K key, int bitLength);
|
||||
|
||||
/**
|
||||
* Returns the value for the entry whose key is closest in a bitwise
|
||||
* XOR metric to the given key. This is NOT lexicographic closeness.
|
||||
* For example, given the keys:<p>
|
||||
* D = 1000100 <br>
|
||||
* H = 1001000 <br>
|
||||
* L = 1001100 <br>
|
||||
* <p>
|
||||
* If the Trie contained 'H' and 'L', a lookup of 'D' would return 'L',
|
||||
* because the XOR distance between D & L is smaller than the XOR distance
|
||||
* between D & H.
|
||||
*/
|
||||
V select(K key);
|
||||
|
||||
/**
|
||||
* Iterates through the Trie, starting with the entry whose bitwise
|
||||
* value is closest in an XOR metric to the given key. After the closest
|
||||
* entry is found, the Trie will call select on that entry and continue
|
||||
* calling select for each entry (traversing in order of XOR closeness,
|
||||
* NOT lexicographically) until the cursor returns
|
||||
* <code>Cursor.SelectStatus.EXIT</code>.<p>
|
||||
* The cursor can return <code>Cursor.SelectStatus.CONTINUE</code> to
|
||||
* continue traversing.<p>
|
||||
* <code>Cursor.SelectStatus.REMOVE_AND_EXIT</code> is used to remove the current element
|
||||
* and stop traversing.
|
||||
* <p>
|
||||
* Note: The {@link Cursor.SelectStatus#REMOVE} operation is not supported.
|
||||
*
|
||||
* @return The entry the cursor returned EXIT on, or null if it continued
|
||||
* till the end.
|
||||
*/
|
||||
Map.Entry<K, V> select(K key, Cursor<? super K, ? super V> cursor);
|
||||
|
||||
/**
|
||||
* Traverses the Trie in lexicographical order. <code>Cursor.select</code>
|
||||
* will be called on each entry.<p>
|
||||
* The traversal will stop when the cursor returns <code>Cursor.SelectStatus.EXIT</code>.<p>
|
||||
* <code>Cursor.SelectStatus.CONTINUE</code> is used to continue traversing.<p>
|
||||
* <code>Cursor.SelectStatus.REMOVE</code> is used to remove the element that was
|
||||
* selected and continue traversing.<p>
|
||||
* <code>Cursor.SelectStatus.REMOVE_AND_EXIT</code> is used to remove the current element
|
||||
* and stop traversing.
|
||||
*
|
||||
* @return The entry the cursor returned EXIT on, or null if it continued
|
||||
* till the end.
|
||||
*/
|
||||
Map.Entry<K, V> traverse(Cursor<? super K, ? super V> cursor);
|
||||
|
||||
/**
|
||||
* An interface used by a {@link Trie}. A {@link Trie} selects items by
|
||||
* closeness and passes the items to the <code>Cursor</code>. You can then
|
||||
* decide what to do with the key-value pair and the return value
|
||||
* from {@link #select(java.util.Map.Entry)} tells the <code>Trie</code>
|
||||
* what to do next.
|
||||
* <p>
|
||||
* <code>Cursor</code> returns status/selection status might be:
|
||||
* <table cellspace="5">
|
||||
* <tr><td><b>Return Value</b></td><td><b>Status</b></td></tr>
|
||||
* <tr><td>EXIT</td><td>Finish the Trie operation</td></tr>
|
||||
* <tr><td>CONTINUE</td><td>Look at the next element in the traversal</td></tr>
|
||||
* <tr><td>REMOVE_AND_EXIT</td><td>Remove the entry and stop iterating</td></tr>
|
||||
* <tr><td>REMOVE</td><td>Remove the entry and continue iterating</td></tr>
|
||||
* </table>
|
||||
* <p>
|
||||
* Note: {@link Trie#select(Object, Trie.Cursor)} does
|
||||
* not support <code>REMOVE</code>.
|
||||
*
|
||||
* @param <K> Key Type
|
||||
* @param <V> Key Value
|
||||
*/
|
||||
interface Cursor<K, V> {
|
||||
|
||||
/**
|
||||
* Notification that the Trie is currently looking at the given entry.
|
||||
* Return <code>EXIT</code> to finish the Trie operation,
|
||||
* <code>CONTINUE</code> to look at the next entry, <code>REMOVE</code>
|
||||
* to remove the entry and continue iterating, or
|
||||
* <code>REMOVE_AND_EXIT</code> to remove the entry and stop iterating.
|
||||
* Not all operations support <code>REMOVE</code>.
|
||||
*/
|
||||
SelectStatus select(Map.Entry<? extends K, ? extends V> entry);
|
||||
|
||||
/**
|
||||
* The mode during selection.
|
||||
*/
|
||||
enum SelectStatus {
|
||||
EXIT, CONTINUE, REMOVE, REMOVE_AND_EXIT
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
package org.xbib.datastructures.trie.limewire;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
/**
|
||||
* A convenience class to aid in developing iterators that cannot be modified.
|
||||
*/
|
||||
public abstract class UnmodifiableIterator<E> implements Iterator<E> {
|
||||
/**
|
||||
* Throws <code>UnsupportedOperationException</code>.
|
||||
*/
|
||||
public final void remove() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
package org.xbib.datastructures.trie.patricia;
|
||||
|
||||
/**
|
||||
* An abstract implementation of {@link KeyAnalyzer}.
|
||||
*/
|
||||
public abstract class AbstractKeyAnalyzer<K> implements KeyAnalyzer<K> {
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public int compare(K o1, K o2) {
|
||||
return ((Comparable<K>) o1).compareTo(o2);
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load diff
|
@ -0,0 +1,193 @@
|
|||
package org.xbib.datastructures.trie.patricia;
|
||||
|
||||
import java.util.AbstractMap;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* This class provides some basic {@link PrefixTree} functionality and
|
||||
* utility methods for actual {@link PrefixTree} implementations.
|
||||
*/
|
||||
abstract class AbstractTrie<K, V> extends AbstractMap<K, V> implements PrefixTree<K, V> {
|
||||
|
||||
/**
|
||||
* The {@link KeyAnalyzer} that's being used to build the
|
||||
* PATRICIA {@link PrefixTree}
|
||||
*/
|
||||
protected final KeyAnalyzer<? super K> keyAnalyzer;
|
||||
|
||||
public AbstractTrie() {
|
||||
this(DefaultKeyAnalyzer.singleton());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new {@link PrefixTree} using the given {@link KeyAnalyzer}
|
||||
*/
|
||||
public AbstractTrie(KeyAnalyzer<? super K> keyAnalyzer) {
|
||||
this.keyAnalyzer = Objects.requireNonNull(keyAnalyzer, "keyAnalyzer");
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the {@link KeyAnalyzer} that constructed the {@link PrefixTree}.
|
||||
*/
|
||||
public KeyAnalyzer<? super K> getKeyAnalyzer() {
|
||||
return keyAnalyzer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public K selectKey(K key) {
|
||||
Map.Entry<K, V> entry = select(key);
|
||||
return entry != null ? entry.getKey() : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public V selectValue(K key) {
|
||||
Map.Entry<K, V> entry = select(key);
|
||||
return entry != null ? entry.getValue() : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder buffer = new StringBuilder();
|
||||
buffer.append("Trie[").append(size()).append("]={\n");
|
||||
for (Map.Entry<K, V> entry : entrySet()) {
|
||||
buffer.append(" ").append(entry).append("\n");
|
||||
}
|
||||
buffer.append("}\n");
|
||||
return buffer.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the length of the given key in bits
|
||||
*
|
||||
* @see KeyAnalyzer#lengthInBits(Object)
|
||||
*/
|
||||
final int lengthInBits(K key) {
|
||||
if (key == null) {
|
||||
return 0;
|
||||
}
|
||||
return keyAnalyzer.lengthInBits(key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether or not the given bit on the
|
||||
* key is set or false if the key is null.
|
||||
*
|
||||
* @see KeyAnalyzer#isBitSet(Object, int)
|
||||
*/
|
||||
final boolean isBitSet(K key, int bitIndex) {
|
||||
if (key == null) { // root's might be null!
|
||||
return false;
|
||||
}
|
||||
return keyAnalyzer.isBitSet(key, bitIndex);
|
||||
}
|
||||
|
||||
/**
|
||||
* Utility method for calling {@link KeyAnalyzer#bitIndex(Object, Object)}
|
||||
*/
|
||||
final int bitIndex(K key, K otherKey) {
|
||||
if (key != null && otherKey != null) {
|
||||
return keyAnalyzer.bitIndex(key, otherKey);
|
||||
} else if (key != null) {
|
||||
return bitIndex(key);
|
||||
} else if (otherKey != null) {
|
||||
return bitIndex(otherKey);
|
||||
}
|
||||
return KeyAnalyzer.NULL_BIT_KEY;
|
||||
}
|
||||
|
||||
private int bitIndex(K key) {
|
||||
int lengthInBits = lengthInBits(key);
|
||||
for (int i = 0; i < lengthInBits; i++) {
|
||||
if (isBitSet(key, i)) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return KeyAnalyzer.NULL_BIT_KEY;
|
||||
}
|
||||
|
||||
/**
|
||||
* An utility method for calling {@link KeyAnalyzer#compare(Object, Object)}
|
||||
*/
|
||||
final boolean compareKeys(K key, K other) {
|
||||
if (key == null) {
|
||||
return (other == null);
|
||||
} else if (other == null) {
|
||||
return false;
|
||||
}
|
||||
return keyAnalyzer.compare(key, other) == 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* A basic implementation of {@link Entry}
|
||||
*/
|
||||
abstract static class BasicEntry<K, V> implements Map.Entry<K, V> {
|
||||
|
||||
protected K key;
|
||||
|
||||
protected V value;
|
||||
|
||||
private transient int hashCode = 0;
|
||||
|
||||
public BasicEntry(K key) {
|
||||
this.key = key;
|
||||
}
|
||||
|
||||
public BasicEntry(K key, V value) {
|
||||
this.key = key;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Replaces the current key and value with the provided
|
||||
* key & value
|
||||
*/
|
||||
public V setKeyValue(K key, V value) {
|
||||
this.key = key;
|
||||
this.hashCode = 0;
|
||||
return setValue(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public K getKey() {
|
||||
return key;
|
||||
}
|
||||
|
||||
@Override
|
||||
public V getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public V setValue(V value) {
|
||||
V previous = this.value;
|
||||
this.value = value;
|
||||
return previous;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
if (hashCode == 0) {
|
||||
hashCode = (key != null ? key.hashCode() : 0);
|
||||
}
|
||||
return hashCode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (o == this) {
|
||||
return true;
|
||||
} else if (!(o instanceof Map.Entry<?, ?>)) {
|
||||
return false;
|
||||
}
|
||||
Map.Entry<?, ?> other = (Map.Entry<?, ?>) o;
|
||||
return (key == null ? other.getKey() == null : key.equals(other.getKey())) &&
|
||||
(value == null ? other.getValue() == null : value.equals(other.getValue()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return key + "=" + value;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,57 @@
|
|||
package org.xbib.datastructures.trie.patricia;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
/**
|
||||
* A {@link Cursor} can be used to traverse a {@link PrefixTree}, visit each node
|
||||
* step by step and make {@link Decision}s on each step how to continue with
|
||||
* traversing the {@link PrefixTree}.
|
||||
*/
|
||||
public interface Cursor<K, V> {
|
||||
|
||||
/**
|
||||
* Called for each {@link Entry} in the {@link PrefixTree}. Return
|
||||
* {@link Decision#EXIT} to finish the {@link PrefixTree} operation,
|
||||
* {@link Decision#CONTINUE} to go to the next {@link Entry},
|
||||
* {@link Decision#REMOVE} to remove the {@link Entry} and
|
||||
* continue iterating or {@link Decision#REMOVE_AND_EXIT} to
|
||||
* remove the {@link Entry} and stop iterating.
|
||||
* <p>
|
||||
* Note: Not all operations support {@link Decision#REMOVE}.
|
||||
*/
|
||||
Decision select(Map.Entry<? extends K, ? extends V> entry);
|
||||
|
||||
/**
|
||||
* The {@link Decision} tells the {@link Cursor} what to do on each step
|
||||
* while traversing the {@link PrefixTree}.
|
||||
* <p>
|
||||
* NOTE: Not all operations that work with a {@link Cursor} support all
|
||||
* {@link Decision} types
|
||||
*/
|
||||
enum Decision {
|
||||
|
||||
/**
|
||||
* Exit the traverse operation
|
||||
*/
|
||||
EXIT,
|
||||
|
||||
/**
|
||||
* Continue with the traverse operation
|
||||
*/
|
||||
CONTINUE,
|
||||
|
||||
/**
|
||||
* Remove the previously returned element
|
||||
* from the {@link PrefixTree} and continue
|
||||
*/
|
||||
REMOVE,
|
||||
|
||||
/**
|
||||
* Remove the previously returned element
|
||||
* from the {@link PrefixTree} and exit from the
|
||||
* traverse operation
|
||||
*/
|
||||
REMOVE_AND_EXIT
|
||||
}
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
package org.xbib.datastructures.trie.patricia;
|
||||
|
||||
/**
|
||||
* An implementation of {@link KeyAnalyzer} that assumes all keys have the {@link Key} interface implemented.
|
||||
*/
|
||||
public class DefaultKeyAnalyzer<K extends Key<K>> extends AbstractKeyAnalyzer<K> {
|
||||
@SuppressWarnings("rawtypes")
|
||||
private static final DefaultKeyAnalyzer INSTANCE = new DefaultKeyAnalyzer();
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public static <K> KeyAnalyzer<K> singleton() {
|
||||
return (KeyAnalyzer<K>) INSTANCE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int lengthInBits(K key) {
|
||||
return key.lengthInBits();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBitSet(K key, int bitIndex) {
|
||||
return key.isBitSet(bitIndex);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int bitIndex(K key, K otherKey) {
|
||||
return key.bitIndex(otherKey);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPrefix(K key, K prefix) {
|
||||
return key.isPrefixedBy(prefix);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
package org.xbib.datastructures.trie.patricia;
|
||||
|
||||
/**
|
||||
* An interface that {@link PatriciaTrie} keys may implement.
|
||||
*
|
||||
* @see KeyAnalyzer
|
||||
* @see DefaultKeyAnalyzer
|
||||
*/
|
||||
public interface Key<K> {
|
||||
|
||||
/**
|
||||
* Returns the key's length in bits.
|
||||
*/
|
||||
int lengthInBits();
|
||||
|
||||
/**
|
||||
* Returns {@code true} if the given bit is set.
|
||||
*/
|
||||
boolean isBitSet(int bitIndex);
|
||||
|
||||
/**
|
||||
* Returns the index of the first bit that is different in the two keys.
|
||||
*/
|
||||
int bitIndex(K otherKey);
|
||||
|
||||
/**
|
||||
* Returns {@code true} if this key is prefixed by the given key.
|
||||
*/
|
||||
boolean isPrefixedBy(K prefix);
|
||||
}
|
|
@ -0,0 +1,49 @@
|
|||
package org.xbib.datastructures.trie.patricia;
|
||||
|
||||
import java.util.Comparator;
|
||||
|
||||
/**
|
||||
* The {@link KeyAnalyzer} provides bit-level access to keys
|
||||
* for the {@link PatriciaTrie}.
|
||||
*/
|
||||
public interface KeyAnalyzer<K> extends Comparator<K> {
|
||||
|
||||
/**
|
||||
* Returned by {@link #bitIndex(Object, Object)} if a key's
|
||||
* bits were all zero (0).
|
||||
*/
|
||||
int NULL_BIT_KEY = -1;
|
||||
|
||||
/**
|
||||
* Returned by {@link #bitIndex(Object, Object)} if a the
|
||||
* bits of two keys were all equal.
|
||||
*/
|
||||
int EQUAL_BIT_KEY = -2;
|
||||
|
||||
/**
|
||||
* Returned by {@link #bitIndex(Object, Object)} if a keys
|
||||
* indices are out of bounds.
|
||||
*/
|
||||
int OUT_OF_BOUNDS_BIT_KEY = -3;
|
||||
|
||||
/**
|
||||
* Returns the key's length in bits.
|
||||
*/
|
||||
int lengthInBits(K key);
|
||||
|
||||
/**
|
||||
* Returns {@code true} if a key's bit it set at the given index.
|
||||
*/
|
||||
boolean isBitSet(K key, int bitIndex);
|
||||
|
||||
/**
|
||||
* Returns the index of the first bit that is different in the two keys.
|
||||
*/
|
||||
int bitIndex(K key, K otherKey);
|
||||
|
||||
/**
|
||||
* Returns {@code true} if the second argument is a
|
||||
* prefix of the first argument.
|
||||
*/
|
||||
boolean isPrefix(K key, K prefix);
|
||||
}
|
File diff suppressed because it is too large
Load diff
|
@ -0,0 +1,121 @@
|
|||
package org.xbib.datastructures.trie.patricia;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.SortedMap;
|
||||
|
||||
/**
|
||||
* Defines the interface for a prefix tree, an ordered tree data structure. For
|
||||
* more information, see <a href="http://en.wikipedia.org/wiki/Trie">Tries</a>.
|
||||
*/
|
||||
public interface PrefixTree<K, V> extends SortedMap<K, V> {
|
||||
|
||||
/**
|
||||
* Returns the {@link Map.Entry} whose key is closest in a bitwise XOR
|
||||
* metric to the given key. This is NOT lexicographic closeness.
|
||||
* For example, given the keys:
|
||||
*
|
||||
* <ol>
|
||||
* <li>D = 1000100
|
||||
* <li>H = 1001000
|
||||
* <li>L = 1001100
|
||||
* </ol>
|
||||
* <p>
|
||||
* If the {@link PrefixTree} contained 'H' and 'L', a lookup of 'D' would
|
||||
* return 'L', because the XOR distance between D & L is smaller
|
||||
* than the XOR distance between D & H.
|
||||
*
|
||||
* @return The {@link Map.Entry} whose key is closest in a bitwise XOR metric
|
||||
* to the provided key.
|
||||
*/
|
||||
Map.Entry<K, V> select(K key);
|
||||
|
||||
/**
|
||||
* Returns the key that is closest in a bitwise XOR metric to the
|
||||
* provided key. This is NOT lexicographic closeness!
|
||||
* <p>
|
||||
* For example, given the keys:
|
||||
*
|
||||
* <ol>
|
||||
* <li>D = 1000100
|
||||
* <li>H = 1001000
|
||||
* <li>L = 1001100
|
||||
* </ol>
|
||||
* <p>
|
||||
* If the {@link PrefixTree} contained 'H' and 'L', a lookup of 'D' would
|
||||
* return 'L', because the XOR distance between D & L is smaller
|
||||
* than the XOR distance between D & H.
|
||||
*
|
||||
* @return The key that is closest in a bitwise XOR metric to the provided key.
|
||||
*/
|
||||
K selectKey(K key);
|
||||
|
||||
/**
|
||||
* Returns the value whose key is closest in a bitwise XOR metric to
|
||||
* the provided key. This is NOT lexicographic closeness!
|
||||
* <p>
|
||||
* For example, given the keys:
|
||||
*
|
||||
* <ol>
|
||||
* <li>D = 1000100
|
||||
* <li>H = 1001000
|
||||
* <li>L = 1001100
|
||||
* </ol>
|
||||
* <p>
|
||||
* If the {@link PrefixTree} contained 'H' and 'L', a lookup of 'D' would
|
||||
* return 'L', because the XOR distance between D & L is smaller
|
||||
* than the XOR distance between D & H.
|
||||
*
|
||||
* @return The value whose key is closest in a bitwise XOR metric
|
||||
* to the provided key.
|
||||
*/
|
||||
V selectValue(K key);
|
||||
|
||||
/**
|
||||
* Iterates through the {@link PrefixTree}, starting with the entry whose bitwise
|
||||
* value is closest in an XOR metric to the given key. After the closest
|
||||
* entry is found, the {@link PrefixTree} will call select on that entry and continue
|
||||
* calling select for each entry (traversing in order of XOR closeness,
|
||||
* NOT lexicographically) until the cursor returns {@link Cursor.Decision#EXIT}.
|
||||
*
|
||||
* <p>The cursor can return {@link Cursor.Decision#CONTINUE} to continue traversing.
|
||||
*
|
||||
* <p>{@link Cursor.Decision#REMOVE_AND_EXIT} is used to remove the current element
|
||||
* and stop traversing.
|
||||
*
|
||||
* <p>Note: The {@link Cursor.Decision#REMOVE} operation is not supported.
|
||||
*
|
||||
* @return The entry the cursor returned {@link Cursor.Decision#EXIT} on, or null
|
||||
* if it continued till the end.
|
||||
*/
|
||||
Map.Entry<K, V> select(K key, Cursor<? super K, ? super V> cursor);
|
||||
|
||||
/**
|
||||
* Traverses the {@link PrefixTree} in lexicographical order.
|
||||
* {@link Cursor#select(java.util.Map.Entry)} will be called on each entry.
|
||||
*
|
||||
* <p>The traversal will stop when the cursor returns {@link Cursor.Decision#EXIT},
|
||||
* {@link Cursor.Decision#CONTINUE} is used to continue traversing and
|
||||
* {@link Cursor.Decision#REMOVE} is used to remove the element that was selected
|
||||
* and continue traversing.
|
||||
*
|
||||
* <p>{@link Cursor.Decision#REMOVE_AND_EXIT} is used to remove the current element
|
||||
* and stop traversing.
|
||||
*
|
||||
* @return The entry the cursor returned {@link Cursor.Decision#EXIT} on, or null
|
||||
* if it continued till the end.
|
||||
*/
|
||||
Map.Entry<K, V> traverse(Cursor<? super K, ? super V> cursor);
|
||||
|
||||
/**
|
||||
* Returns a view of this {@link PrefixTree} of all elements that are prefixed
|
||||
* by the given key.
|
||||
*
|
||||
* <p>In a {@link PrefixTree} with fixed size keys, this is essentially a
|
||||
* {@link #get(Object)} operation.
|
||||
*
|
||||
* <p>For example, if the {@link PrefixTree} contains 'Anna', 'Anael',
|
||||
* 'Analu', 'Andreas', 'Andrea', 'Andres', and 'Anatole', then
|
||||
* a lookup of 'And' would return 'Andreas', 'Andrea', and 'Andres'.
|
||||
*/
|
||||
SortedMap<K, V> prefixMap(K prefix);
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
package org.xbib.datastructures.trie.radix;
|
||||
|
||||
/**
|
||||
* Exception thrown if a duplicate key is inserted in a {@link RadixTree}
|
||||
*/
|
||||
public class DuplicateKeyException extends RuntimeException {
|
||||
public DuplicateKeyException(String msg) {
|
||||
super(msg);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,74 @@
|
|||
package org.xbib.datastructures.trie.radix;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Represents a node of a Radix tree {@link RadixTreeImpl}
|
||||
*
|
||||
* @param <T>
|
||||
*/
|
||||
class Node<T> {
|
||||
|
||||
private String key;
|
||||
|
||||
private List<Node<T>> children;
|
||||
|
||||
private boolean real;
|
||||
|
||||
private T value;
|
||||
|
||||
public Node() {
|
||||
key = "";
|
||||
children = new ArrayList<>();
|
||||
real = false;
|
||||
}
|
||||
|
||||
public T getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(T data) {
|
||||
this.value = data;
|
||||
}
|
||||
|
||||
public String getKey() {
|
||||
return key;
|
||||
}
|
||||
|
||||
public void setKey(String value) {
|
||||
this.key = value;
|
||||
}
|
||||
|
||||
public boolean isReal() {
|
||||
return real;
|
||||
}
|
||||
|
||||
public void setReal(boolean datanode) {
|
||||
this.real = datanode;
|
||||
}
|
||||
|
||||
public List<Node<T>> getChildren() {
|
||||
return children;
|
||||
}
|
||||
|
||||
public void setChildren(List<Node<T>> childern) {
|
||||
this.children = childern;
|
||||
}
|
||||
|
||||
public int getNumberOfMatchingCharacters(String key) {
|
||||
int numberOfMatchingCharacters = 0;
|
||||
while (numberOfMatchingCharacters < key.length() && numberOfMatchingCharacters < this.getKey().length()) {
|
||||
if (key.charAt(numberOfMatchingCharacters) != this.getKey().charAt(numberOfMatchingCharacters)) {
|
||||
break;
|
||||
}
|
||||
numberOfMatchingCharacters++;
|
||||
}
|
||||
return numberOfMatchingCharacters;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return key;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,77 @@
|
|||
package org.xbib.datastructures.trie.radix;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* This interface represent the operation of a radix tree. A radix tree,
|
||||
* Patricia trie/tree, or crit bit tree is a specialized set data structure
|
||||
* based on the trie that is used to store a set of strings. In contrast with a
|
||||
* regular trie, the edges of a Patricia trie are labelled with sequences of
|
||||
* characters rather than with single characters. These can be strings of
|
||||
* characters, bit strings such as integers or IP addresses, or generally
|
||||
* arbitrary sequences of objects in lexicographical order. Sometimes the names
|
||||
* radix tree and crit bit tree are only applied to trees storing integers and
|
||||
* Patricia trie is retained for more general inputs, but the structure works
|
||||
* the same way in all cases.
|
||||
*
|
||||
* https://code.google.com/archive/p/radixtree/
|
||||
*/
|
||||
public interface RadixTree<T> {
|
||||
/**
|
||||
* Insert a new string key and its value to the tree.
|
||||
*
|
||||
* @param key The string key of the object
|
||||
* @param value The value that need to be stored corresponding to the given
|
||||
* key.
|
||||
*/
|
||||
void insert(String key, T value);
|
||||
|
||||
/**
|
||||
* Delete a key and its associated value from the tree.
|
||||
*
|
||||
* @param key The key of the node that need to be deleted
|
||||
* @return true if deleted
|
||||
*/
|
||||
boolean delete(String key);
|
||||
|
||||
/**
|
||||
* Find a value based on its corresponding key.
|
||||
*
|
||||
* @param key The key for which to search the tree.
|
||||
* @return The value corresponding to the key. null if iot can not find the key
|
||||
*/
|
||||
T search(String key);
|
||||
|
||||
/**
|
||||
* Find an existing entry and replace it's value. If no existing entry, do nothing
|
||||
*
|
||||
* @param key The key for which to search the tree.
|
||||
* @param value The value to set for the entry
|
||||
* @return true if an entry was found for the given key, false if not found
|
||||
*/
|
||||
boolean replace(String key, T value);
|
||||
|
||||
/**
|
||||
* Check if the tree contains any entry corresponding to the given key.
|
||||
*
|
||||
* @param key The key that needto be searched in the tree.
|
||||
* @return retun true if the key is present in the tree otherwise false
|
||||
*/
|
||||
boolean contains(String key);
|
||||
|
||||
/**
|
||||
* Search for all the keys that start with given prefix. limiting the results based on the supplied limit.
|
||||
*
|
||||
* @param prefix The prefix for which keys need to be search
|
||||
* @param recordLimit The limit for the results
|
||||
* @return The list of values those key start with the given prefix
|
||||
*/
|
||||
List<T> searchPrefix(String prefix, int recordLimit);
|
||||
|
||||
/**
|
||||
* Return the size of the Radix tree
|
||||
*
|
||||
* @return the size of the tree
|
||||
*/
|
||||
long getSize();
|
||||
}
|
|
@ -0,0 +1,275 @@
|
|||
package org.xbib.datastructures.trie.radix;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Queue;
|
||||
|
||||
/**
|
||||
* Implementation for Radix tree {@link RadixTree}
|
||||
*/
|
||||
public class RadixTreeImpl<T> implements RadixTree<T> {
|
||||
|
||||
protected Node<T> root;
|
||||
|
||||
protected long size;
|
||||
|
||||
public RadixTreeImpl() {
|
||||
root = new Node<>();
|
||||
root.setKey("");
|
||||
size = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public T search(String key) {
|
||||
Visitor<T, T> visitor = new VisitorImpl<>() {
|
||||
@Override
|
||||
public void visit(String key, Node<T> parent, Node<T> node) {
|
||||
if (node.isReal()) {
|
||||
result = node.getValue();
|
||||
}
|
||||
}
|
||||
};
|
||||
visit(key, visitor);
|
||||
return visitor.getResult();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean replace(String key, final T value) {
|
||||
Visitor<T, T> visitor = new VisitorImpl<>() {
|
||||
public void visit(String key, Node<T> parent, Node<T> node) {
|
||||
if (node.isReal()) {
|
||||
node.setValue(value);
|
||||
result = value;
|
||||
} else {
|
||||
result = null;
|
||||
}
|
||||
}
|
||||
};
|
||||
visit(key, visitor);
|
||||
return visitor.getResult() != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean delete(String key) {
|
||||
Visitor<T, Boolean> visitor = new VisitorImpl<>(Boolean.FALSE) {
|
||||
public void visit(String key, Node<T> parent, Node<T> node) {
|
||||
result = node.isReal();
|
||||
if (result) {
|
||||
if (node.getChildren().size() == 0) {
|
||||
Iterator<Node<T>> it = parent.getChildren().iterator();
|
||||
while (it.hasNext()) {
|
||||
if (it.next().getKey().equals(node.getKey())) {
|
||||
it.remove();
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (parent.getChildren().size() == 1 && !parent.isReal()) {
|
||||
mergeNodes(parent, parent.getChildren().get(0));
|
||||
}
|
||||
} else if (node.getChildren().size() == 1) {
|
||||
mergeNodes(node, node.getChildren().get(0));
|
||||
} else {
|
||||
node.setReal(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Merge a child into its parent node. Operation only valid if it is
|
||||
* only child of the parent node and parent node is not a real node.
|
||||
*
|
||||
* @param parent The parent Node
|
||||
* @param child The child Node
|
||||
*/
|
||||
private void mergeNodes(Node<T> parent,
|
||||
Node<T> child) {
|
||||
parent.setKey(parent.getKey() + child.getKey());
|
||||
parent.setReal(child.isReal());
|
||||
parent.setValue(child.getValue());
|
||||
parent.setChildren(child.getChildren());
|
||||
}
|
||||
};
|
||||
visit(key, visitor);
|
||||
if (visitor.getResult()) {
|
||||
size--;
|
||||
}
|
||||
return visitor.getResult();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void insert(String key, T value) throws DuplicateKeyException {
|
||||
insert(key, root, value);
|
||||
size++;
|
||||
}
|
||||
|
||||
/**
|
||||
* Recursively insert the key in the radix tree.
|
||||
*
|
||||
* @param key The key to be inserted
|
||||
* @param node The current node
|
||||
* @param value The value associated with the key
|
||||
* @throws DuplicateKeyException If the key already exists in the database.
|
||||
*/
|
||||
private void insert(String key, Node<T> node, T value)
|
||||
throws DuplicateKeyException {
|
||||
int numberOfMatchingCharacters = node.getNumberOfMatchingCharacters(key);
|
||||
if (node.getKey().equals("") || numberOfMatchingCharacters == 0 ||
|
||||
(numberOfMatchingCharacters < key.length() && numberOfMatchingCharacters >= node.getKey().length())) {
|
||||
boolean flag = false;
|
||||
String newText = key.substring(numberOfMatchingCharacters);
|
||||
for (Node<T> child : node.getChildren()) {
|
||||
if (child.getKey().startsWith(newText.charAt(0) + "")) {
|
||||
flag = true;
|
||||
insert(newText, child, value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!flag) {
|
||||
Node<T> n = new Node<>();
|
||||
n.setKey(newText);
|
||||
n.setReal(true);
|
||||
n.setValue(value);
|
||||
node.getChildren().add(n);
|
||||
}
|
||||
} else if (numberOfMatchingCharacters == key.length() && numberOfMatchingCharacters == node.getKey().length()) {
|
||||
if (node.isReal()) {
|
||||
throw new DuplicateKeyException("Duplicate key");
|
||||
}
|
||||
node.setReal(true);
|
||||
node.setValue(value);
|
||||
}
|
||||
else if (numberOfMatchingCharacters > 0 && numberOfMatchingCharacters < node.getKey().length()) {
|
||||
Node<T> n1 = new Node<>();
|
||||
n1.setKey(node.getKey().substring(numberOfMatchingCharacters));
|
||||
n1.setReal(node.isReal());
|
||||
n1.setValue(node.getValue());
|
||||
n1.setChildren(node.getChildren());
|
||||
node.setKey(key.substring(0, numberOfMatchingCharacters));
|
||||
node.setReal(false);
|
||||
node.setChildren(new ArrayList<>());
|
||||
node.getChildren().add(n1);
|
||||
if (numberOfMatchingCharacters < key.length()) {
|
||||
Node<T> n2 = new Node<>();
|
||||
n2.setKey(key.substring(numberOfMatchingCharacters));
|
||||
n2.setReal(true);
|
||||
n2.setValue(value);
|
||||
node.getChildren().add(n2);
|
||||
} else {
|
||||
node.setValue(value);
|
||||
node.setReal(true);
|
||||
}
|
||||
} else {
|
||||
Node<T> n = new Node<>();
|
||||
n.setKey(node.getKey().substring(numberOfMatchingCharacters));
|
||||
n.setChildren(node.getChildren());
|
||||
n.setReal(node.isReal());
|
||||
n.setValue(node.getValue());
|
||||
node.setKey(key);
|
||||
node.setReal(true);
|
||||
node.setValue(value);
|
||||
node.getChildren().add(n);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<T> searchPrefix(String key, int recordLimit) {
|
||||
List<T> keys = new ArrayList<>();
|
||||
Node<T> node = searchPefix(key, root);
|
||||
if (node != null) {
|
||||
if (node.isReal()) {
|
||||
keys.add(node.getValue());
|
||||
}
|
||||
getNodes(node, keys, recordLimit);
|
||||
}
|
||||
return keys;
|
||||
}
|
||||
|
||||
private void getNodes(Node<T> parent, List<T> keys, int limit) {
|
||||
Queue<Node<T>> queue = new LinkedList<>(parent.getChildren());
|
||||
while (!queue.isEmpty()) {
|
||||
Node<T> node = queue.remove();
|
||||
if (node.isReal()) {
|
||||
keys.add(node.getValue());
|
||||
}
|
||||
if (keys.size() == limit) {
|
||||
break;
|
||||
}
|
||||
queue.addAll(node.getChildren());
|
||||
}
|
||||
}
|
||||
|
||||
private Node<T> searchPefix(String key, Node<T> node) {
|
||||
Node<T> result = null;
|
||||
int numberOfMatchingCharacters = node.getNumberOfMatchingCharacters(key);
|
||||
if (numberOfMatchingCharacters == key.length() && numberOfMatchingCharacters <= node.getKey().length()) {
|
||||
result = node;
|
||||
} else if (node.getKey().equals("")
|
||||
|| (numberOfMatchingCharacters < key.length() && numberOfMatchingCharacters >= node.getKey().length())) {
|
||||
String newText = key.substring(numberOfMatchingCharacters);
|
||||
for (Node<T> child : node.getChildren()) {
|
||||
if (child.getKey().startsWith(newText.charAt(0) + "")) {
|
||||
result = searchPefix(newText, child);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean contains(String key) {
|
||||
Visitor<T, Boolean> visitor = new VisitorImpl<>(Boolean.FALSE) {
|
||||
@Override
|
||||
public void visit(String key, Node<T> parent, Node<T> node) {
|
||||
result = node.isReal();
|
||||
}
|
||||
};
|
||||
visit(key, visitor);
|
||||
return visitor.getResult();
|
||||
}
|
||||
|
||||
/**
|
||||
* visit the node those key matches the given key
|
||||
*
|
||||
* @param key The key that need to be visited
|
||||
* @param visitor The visitor object
|
||||
*/
|
||||
public <R> void visit(String key, Visitor<T, R> visitor) {
|
||||
if (root != null) {
|
||||
visit(key, visitor, null, root);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* recursively visit the tree based on the supplied "key". calls the Visitor
|
||||
* for the node those key matches the given prefix
|
||||
*
|
||||
* @param prefix The key o prefix to search in the tree
|
||||
* @param visitor The Visitor that will be called if a node with "key" as its
|
||||
* key is found
|
||||
* @param node The Node from where onward to search
|
||||
*/
|
||||
private <R> void visit(String prefix, Visitor<T, R> visitor,
|
||||
Node<T> parent, Node<T> node) {
|
||||
int numberOfMatchingCharacters = node.getNumberOfMatchingCharacters(prefix);
|
||||
if (numberOfMatchingCharacters == prefix.length() && numberOfMatchingCharacters == node.getKey().length()) {
|
||||
visitor.visit(prefix, parent, node);
|
||||
} else if (node.getKey().equals("")
|
||||
|| (numberOfMatchingCharacters < prefix.length() && numberOfMatchingCharacters >= node.getKey().length())) { // OR we need to
|
||||
String newText = prefix.substring(numberOfMatchingCharacters);
|
||||
for (Node<T> child : node.getChildren()) {
|
||||
if (child.getKey().startsWith(newText.charAt(0) + "")) {
|
||||
visit(newText, visitor, node, child);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getSize() {
|
||||
return size;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
package org.xbib.datastructures.trie.radix;
|
||||
|
||||
/**
|
||||
* The visitor interface that is used by {@link RadixTreeImpl} for perfroming
|
||||
* task on a searched node.
|
||||
*/
|
||||
public interface Visitor<T, R> {
|
||||
/**
|
||||
* This method gets called by {@link RadixTreeImpl#visit(String, Visitor) visit}
|
||||
* when it finds a node matching the key given to it.
|
||||
*
|
||||
* @param key The key that matched the node
|
||||
* @param parent The parent of the node being visited
|
||||
* @param node The node that is being visited
|
||||
*/
|
||||
void visit(String key, Node<T> parent, Node<T> node);
|
||||
|
||||
/**
|
||||
* The visitor can store any type of result object, depending on the context of
|
||||
* what it is being used for.
|
||||
*
|
||||
* @return The result captured by the visitor.
|
||||
*/
|
||||
R getResult();
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
package org.xbib.datastructures.trie.radix;
|
||||
|
||||
/**
|
||||
* A simple standard implementation for a {@link Visitor}.
|
||||
*/
|
||||
public abstract class VisitorImpl<T, R> implements Visitor<T, R> {
|
||||
|
||||
protected R result;
|
||||
|
||||
public VisitorImpl() {
|
||||
this.result = null;
|
||||
}
|
||||
|
||||
public VisitorImpl(R initialValue) {
|
||||
this.result = initialValue;
|
||||
}
|
||||
|
||||
public R getResult() {
|
||||
return result;
|
||||
}
|
||||
|
||||
abstract public void visit(String key, Node<T> parent, Node<T> node);
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
package org.xbib.datastructures.trie.radix.pruning;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class Node
|
||||
{
|
||||
private List<NodeChild> children;
|
||||
|
||||
//Does this node represent the last character in a word?
|
||||
//0: no word; >0: is word (termFrequencyCount)
|
||||
private long termFrequencyCount;
|
||||
|
||||
private long termFrequencyCountChildMax;
|
||||
|
||||
public Node(long termfrequencyCount)
|
||||
{
|
||||
this.termFrequencyCount = termfrequencyCount;
|
||||
}
|
||||
|
||||
public List<NodeChild> getChildren() {
|
||||
return children;
|
||||
}
|
||||
|
||||
public void setChildren(List<NodeChild> children) {
|
||||
this.children = children;
|
||||
}
|
||||
|
||||
public long getTermFrequencyCount() {
|
||||
return termFrequencyCount;
|
||||
}
|
||||
|
||||
public void setTermFrequencyCount(long termFrequencyCount) {
|
||||
this.termFrequencyCount = termFrequencyCount;
|
||||
}
|
||||
|
||||
public long getTermFrequencyCountChildMax() {
|
||||
return termFrequencyCountChildMax;
|
||||
}
|
||||
|
||||
public void setTermFrequencyCountChildMax(long termFrequencyCountChildMax) {
|
||||
this.termFrequencyCountChildMax = termFrequencyCountChildMax;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
package org.xbib.datastructures.trie.radix.pruning;
|
||||
|
||||
public class NodeChild {
|
||||
private String key;
|
||||
|
||||
private Node node;
|
||||
|
||||
public String getKey() {
|
||||
return key;
|
||||
}
|
||||
|
||||
public void setKey(String key) {
|
||||
this.key = key;
|
||||
}
|
||||
|
||||
public Node getNode() {
|
||||
return node;
|
||||
}
|
||||
|
||||
public void setNode(Node node) {
|
||||
this.node = node;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "NodeChild [key=" + key + ", node=" + node + "]";
|
||||
}
|
||||
|
||||
public NodeChild(String key, Node node) {
|
||||
super();
|
||||
this.key = key;
|
||||
this.node = node;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,204 @@
|
|||
package org.xbib.datastructures.trie.radix.pruning;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
public class PruningRadixTrie {
|
||||
|
||||
public long termCount = 0;
|
||||
|
||||
private final Node trie;
|
||||
|
||||
public PruningRadixTrie() {
|
||||
this.trie = new Node(0);
|
||||
}
|
||||
|
||||
public void addTerm(String term, long termFrequencyCount) {
|
||||
List<Node> nodeList = new ArrayList<>();
|
||||
addTerm(trie, term, termFrequencyCount, 0, 0, nodeList);
|
||||
}
|
||||
|
||||
public void updateMaxCounts(List<Node> nodeList, long termFrequencyCount) {
|
||||
for (Node node : nodeList) {
|
||||
if (termFrequencyCount > node.getTermFrequencyCountChildMax()) {
|
||||
node.setTermFrequencyCountChildMax(termFrequencyCount);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void addTerm(Node curr, String term, long termFrequencyCount, int id, int level, List<Node> nodeList)
|
||||
{
|
||||
try {
|
||||
nodeList.add(curr);
|
||||
int common = 0;
|
||||
List<NodeChild> currChildren = curr.getChildren();
|
||||
if (currChildren != null) {
|
||||
for (int j = 0; j < currChildren.size(); j++) {
|
||||
String key = currChildren.get(j).getKey();
|
||||
Node node = currChildren.get(j).getNode();
|
||||
|
||||
for (int i = 0; i < Math.min(term.length(), key.length()); i++) {
|
||||
if (term.charAt(i) == key.charAt(i)) common = i + 1;
|
||||
else break;
|
||||
}
|
||||
|
||||
if (common > 0) {
|
||||
//term already existed
|
||||
//existing ab
|
||||
//new ab
|
||||
if ((common == term.length()) && (common == key.length())) {
|
||||
if (node.getTermFrequencyCount() == 0) termCount++;
|
||||
node.setTermFrequencyCount(node.getTermFrequencyCount() + termFrequencyCount);
|
||||
updateMaxCounts(nodeList, node.getTermFrequencyCount());
|
||||
}
|
||||
//new is subkey
|
||||
//existing abcd
|
||||
//new ab
|
||||
//if new is shorter (== common), then node(count) and only 1. children add (clause2)
|
||||
else if (common == term.length()) {
|
||||
//insert second part of oldKey as child
|
||||
Node child = new Node(termFrequencyCount);
|
||||
List<NodeChild> l = new ArrayList<>();
|
||||
l.add(new NodeChild(key.substring(common), node));
|
||||
child.setChildren(l);
|
||||
|
||||
child.setTermFrequencyCountChildMax(
|
||||
Math.max(node.getTermFrequencyCountChildMax(), node.getTermFrequencyCount()));
|
||||
updateMaxCounts(nodeList, termFrequencyCount);
|
||||
|
||||
//insert first part as key, overwrite old node
|
||||
currChildren.set(j, new NodeChild(term.substring(0, common), child));
|
||||
//sort children descending by termFrequencyCountChildMax to start lookup with most promising branch
|
||||
Collections.sort(currChildren, Comparator.comparing(
|
||||
(NodeChild e) -> e.getNode().getTermFrequencyCountChildMax()).reversed());
|
||||
//increment termcount by 1
|
||||
termCount++;
|
||||
}
|
||||
//if oldkey shorter (==common), then recursive addTerm (clause1)
|
||||
//existing: te
|
||||
//new: test
|
||||
else if (common == key.length()) {
|
||||
addTerm(node, term.substring(common), termFrequencyCount, id, level + 1, nodeList);
|
||||
}
|
||||
//old and new have common substrings
|
||||
//existing: test
|
||||
//new: team
|
||||
else {
|
||||
//insert second part of oldKey and of s as child
|
||||
Node child = new Node(0);//count
|
||||
List<NodeChild> l = new ArrayList<>();
|
||||
l.add(new NodeChild(key.substring(common), node));
|
||||
l.add(new NodeChild(term.substring(common), new Node(termFrequencyCount)));
|
||||
child.setChildren(l);
|
||||
|
||||
child.setTermFrequencyCountChildMax(
|
||||
Math.max(node.getTermFrequencyCountChildMax(), Math.max(termFrequencyCount, node.getTermFrequencyCount())));
|
||||
updateMaxCounts(nodeList, termFrequencyCount);
|
||||
|
||||
//insert first part as key, overwrite old node
|
||||
currChildren.set(j, new NodeChild(term.substring(0, common), child));
|
||||
//sort children descending by termFrequencyCountChildMax to start lookup with most promising branch
|
||||
Collections.sort(currChildren, Comparator.comparing(
|
||||
(NodeChild e) -> e.getNode().getTermFrequencyCountChildMax()).reversed());
|
||||
//increment termcount by 1
|
||||
termCount++;
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// initialize dictionary if first key is inserted
|
||||
if (currChildren == null) {
|
||||
List<NodeChild> l = new ArrayList<>();
|
||||
l.add(new NodeChild(term, new Node(termFrequencyCount)));
|
||||
curr.setChildren(l);
|
||||
}
|
||||
else {
|
||||
currChildren.add(new NodeChild(term, new Node(termFrequencyCount)));
|
||||
//sort children descending by termFrequencyCountChildMax to start lookup with most promising branch
|
||||
currChildren.sort(Comparator.comparing(
|
||||
(NodeChild e) -> e.getNode().getTermFrequencyCountChildMax()).reversed());
|
||||
}
|
||||
termCount++;
|
||||
updateMaxCounts(nodeList, termFrequencyCount);
|
||||
} catch (Exception e) { System.out.println("exception: " + term + " " + e.getMessage()); }
|
||||
}
|
||||
|
||||
public void findAllChildTerms(String prefix, int topK, String prefixString, List<TermAndFrequency> results, Boolean pruning) {
|
||||
findAllChildTerms(prefix, trie, topK, prefixString, results, pruning);
|
||||
}
|
||||
|
||||
public void findAllChildTerms(String prefix, Node curr, int topK, String prefixString, List<TermAndFrequency> results, Boolean pruning)
|
||||
{
|
||||
try {
|
||||
//pruning/early termination in radix trie lookup
|
||||
if (pruning && (topK > 0) && (results.size() == topK) &&
|
||||
(curr.getTermFrequencyCountChildMax() <= results.get(topK - 1).getTermFrequencyCount())) {
|
||||
return;
|
||||
}
|
||||
|
||||
//test for common prefix (with possibly different suffix)
|
||||
boolean noPrefix = prefix.equals("");
|
||||
|
||||
if (curr.getChildren() != null) {
|
||||
for (NodeChild nodeChild : curr.getChildren()) {
|
||||
String key = nodeChild.getKey();
|
||||
Node node = nodeChild.getNode();
|
||||
//pruning/early termination in radix trie lookup
|
||||
if (pruning && (topK > 0) && (results.size() == topK) &&
|
||||
(node.getTermFrequencyCount() <= results.get(topK - 1).getTermFrequencyCount()) &&
|
||||
(node.getTermFrequencyCountChildMax() <= results.get(topK - 1).getTermFrequencyCount())) {
|
||||
if (!noPrefix) break;
|
||||
else continue;
|
||||
}
|
||||
|
||||
if (noPrefix || key.startsWith(prefix)) {
|
||||
if (node.getTermFrequencyCount() > 0) {
|
||||
if (topK > 0) addTopKSuggestion(prefixString + key, node.getTermFrequencyCount(), topK, results);
|
||||
else results.add(new TermAndFrequency(prefixString + key, node.getTermFrequencyCount()));
|
||||
}
|
||||
|
||||
if ((node.getChildren() != null) && (node.getChildren().size() > 0)) {
|
||||
findAllChildTerms("", node, topK, prefixString + key, results, pruning);
|
||||
}
|
||||
if (!noPrefix) break;
|
||||
} else if (prefix.startsWith(key)) {
|
||||
if ((node.getChildren() != null) && (node.getChildren().size() > 0)) {
|
||||
findAllChildTerms(prefix.substring(key.length()), node, topK, prefixString + key, results, pruning);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) { System.out.println("exception: " + prefix + " " + e.getMessage()); }
|
||||
}
|
||||
|
||||
public List<TermAndFrequency> getTopkTermsForPrefix(String prefix, int topK) {
|
||||
return getTopkTermsForPrefix(prefix, topK, true);
|
||||
}
|
||||
|
||||
public List<TermAndFrequency> getTopkTermsForPrefix(String prefix, int topK, Boolean pruning) {
|
||||
List<TermAndFrequency> results = new ArrayList<>();
|
||||
findAllChildTerms(prefix, topK, "", results, pruning);
|
||||
return results;
|
||||
}
|
||||
|
||||
public void addTopKSuggestion(String term, long termFrequencyCount, int topK, List<TermAndFrequency> results)
|
||||
{
|
||||
//at the end/highest index is the lowest value
|
||||
// > : old take precedence for equal rank
|
||||
// >= : new take precedence for equal rank
|
||||
if ((results.size() < topK) || (termFrequencyCount >= results.get(topK - 1).getTermFrequencyCount())) {
|
||||
TermAndFrequency termAndFrequency = new TermAndFrequency(term, termFrequencyCount);
|
||||
int index = Collections.binarySearch(results, termAndFrequency, Comparator.comparing(
|
||||
TermAndFrequency::getTermFrequencyCount).reversed()); // descending order
|
||||
if (index < 0) results.add(~index, termAndFrequency);
|
||||
else results.add(index, termAndFrequency);
|
||||
|
||||
if (results.size() > topK) results.remove(topK);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,56 @@
|
|||
package org.xbib.datastructures.trie.radix.pruning;
|
||||
|
||||
public class TermAndFrequency {
|
||||
private String term;
|
||||
private long termFrequencyCount;
|
||||
|
||||
public String getTerm() {
|
||||
return term;
|
||||
}
|
||||
public void setTerm(String term) {
|
||||
this.term = term;
|
||||
}
|
||||
public long getTermFrequencyCount() {
|
||||
return termFrequencyCount;
|
||||
}
|
||||
public void setTermFrequencyCount(long termFrequencyCount) {
|
||||
this.termFrequencyCount = termFrequencyCount;
|
||||
}
|
||||
@Override
|
||||
public String toString() {
|
||||
return "TermAndFrequency [term=" + term + ", termFrequencyCount=" + termFrequencyCount + "]";
|
||||
}
|
||||
public TermAndFrequency(String term, long termFrequencyCount) {
|
||||
super();
|
||||
this.term = term;
|
||||
this.termFrequencyCount = termFrequencyCount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((term == null) ? 0 : term.hashCode());
|
||||
result = prime * result + (int) (termFrequencyCount ^ (termFrequencyCount >>> 32));
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
TermAndFrequency other = (TermAndFrequency) obj;
|
||||
if (term == null) {
|
||||
if (other.term != null)
|
||||
return false;
|
||||
} else if (!term.equals(other.term))
|
||||
return false;
|
||||
if (termFrequencyCount != other.termFrequencyCount)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,57 @@
|
|||
package org.xbib.datastructures.trie;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertNotEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertNull;
|
||||
|
||||
public class TrieTest {
|
||||
|
||||
@Test
|
||||
public void testEmptyTrie() {
|
||||
Trie<Integer> trie = new TrieImpl<>();
|
||||
Integer result = trie.search("Value");
|
||||
assertNull(result);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEmptyKey() {
|
||||
Trie<Integer> trie = new TrieImpl<>();
|
||||
trie.add("", 100);
|
||||
Integer result = trie.search("");
|
||||
assertEquals(result, (Integer) 100);
|
||||
trie.add("", 200);
|
||||
result = trie.search("");
|
||||
assertEquals(result, (Integer) 200);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSingletonTrie() {
|
||||
Trie<String> trie = new TrieImpl<>();
|
||||
trie.add("key", "value");
|
||||
String result = trie.search("key");
|
||||
assertNotEquals(result, "key");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLargeInsertionAndSearch() {
|
||||
Trie<Long> trie = new TrieImpl<>();
|
||||
List<String> keys = new ArrayList<>();
|
||||
for (int i = 0; i < 10000; i++) {
|
||||
Random random = new Random();
|
||||
Long value = random.nextLong();
|
||||
String key = value.toString();
|
||||
trie.add(key, value);
|
||||
keys.add(key);
|
||||
}
|
||||
for (String key : keys) {
|
||||
Long value = trie.search(key);
|
||||
assertEquals(key, value.toString());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,83 @@
|
|||
package org.xbib.datastructures.trie.patricia;
|
||||
|
||||
/**
|
||||
* A {@link KeyAnalyzer} for {@link Character}s.
|
||||
*/
|
||||
public class CharacterKeyAnalyzer extends AbstractKeyAnalyzer<Character> {
|
||||
|
||||
/**
|
||||
* A {@link CharacterKeyAnalyzer} that uses all bits (16) of a {@code char}.
|
||||
*/
|
||||
public static final CharacterKeyAnalyzer CHAR = new CharacterKeyAnalyzer(Character.SIZE);
|
||||
|
||||
/**
|
||||
* A {@link CharacterKeyAnalyzer} that uses only the lower 8bits of a {@code char}.
|
||||
*/
|
||||
public static final CharacterKeyAnalyzer BYTE = new CharacterKeyAnalyzer(Byte.SIZE);
|
||||
|
||||
public static final CharacterKeyAnalyzer INSTANCE = CHAR;
|
||||
|
||||
private final int size;
|
||||
|
||||
private final int msb;
|
||||
|
||||
private CharacterKeyAnalyzer(int size) {
|
||||
this(size, 1 << size - 1);
|
||||
}
|
||||
|
||||
private CharacterKeyAnalyzer(int size, int msb) {
|
||||
this.size = size;
|
||||
this.msb = msb;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a bit mask where the given bit is set
|
||||
*/
|
||||
private int mask(int bit) {
|
||||
return msb >>> bit;
|
||||
}
|
||||
|
||||
private char valueOf(Character ch) {
|
||||
char value = ch;
|
||||
if (size == Byte.SIZE) {
|
||||
value &= 0xFF;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int lengthInBits(Character key) {
|
||||
return size;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBitSet(Character key, int bitIndex) {
|
||||
return (key & mask(bitIndex)) != 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int bitIndex(Character key, Character otherKey) {
|
||||
char ch1 = valueOf(key);
|
||||
char ch2 = valueOf(otherKey);
|
||||
|
||||
if (ch1 == 0) {
|
||||
return NULL_BIT_KEY;
|
||||
}
|
||||
|
||||
if (ch1 != ch2) {
|
||||
int xor = ch1 ^ ch2;
|
||||
for (int i = 0; i < size; i++) {
|
||||
if ((xor & mask(i)) != 0) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return KeyAnalyzer.EQUAL_BIT_KEY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPrefix(Character key, Character prefix) {
|
||||
return key.equals(prefix);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,57 @@
|
|||
package org.xbib.datastructures.trie.patricia;
|
||||
|
||||
/**
|
||||
* A {@link KeyAnalyzer} for {@link Integer}s.
|
||||
*/
|
||||
public class IntegerKeyAnalyzer extends AbstractKeyAnalyzer<Integer> {
|
||||
|
||||
public static final IntegerKeyAnalyzer INSTANCE = new IntegerKeyAnalyzer();
|
||||
|
||||
/**
|
||||
* A bit mask where the first bit is 1 and the others are zero
|
||||
*/
|
||||
private static final int MSB = 1 << Integer.SIZE - 1;
|
||||
|
||||
/**
|
||||
* Returns a bit mask where the given bit is set
|
||||
*/
|
||||
private static int mask(int bit) {
|
||||
return MSB >>> bit;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int lengthInBits(Integer key) {
|
||||
return Integer.SIZE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBitSet(Integer key, int bitIndex) {
|
||||
return (key & mask(bitIndex)) != 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int bitIndex(Integer key, Integer otherKey) {
|
||||
int keyValue = key.intValue();
|
||||
if (keyValue == 0) {
|
||||
return NULL_BIT_KEY;
|
||||
}
|
||||
|
||||
int otherValue = otherKey.intValue();
|
||||
|
||||
if (keyValue != otherValue) {
|
||||
int xorValue = keyValue ^ otherValue;
|
||||
for (int i = 0; i < Integer.SIZE; i++) {
|
||||
if ((xorValue & mask(i)) != 0) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return KeyAnalyzer.EQUAL_BIT_KEY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPrefix(Integer key, Integer prefix) {
|
||||
return key.equals(prefix);
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load diff
|
@ -0,0 +1,109 @@
|
|||
package org.xbib.datastructures.trie.patricia;
|
||||
|
||||
/**
|
||||
* A {@link KeyAnalyzer} for {@link String}s.
|
||||
*/
|
||||
public class StringKeyAnalyzer extends AbstractKeyAnalyzer<String> {
|
||||
|
||||
/**
|
||||
* A {@link StringKeyAnalyzer} that uses all bits (16) of a {@code char}.
|
||||
*/
|
||||
public static final StringKeyAnalyzer CHAR = new StringKeyAnalyzer(Character.SIZE);
|
||||
|
||||
/**
|
||||
* A {@link StringKeyAnalyzer} that uses only the lower 8 bits of each {@code char}.
|
||||
*/
|
||||
public static final StringKeyAnalyzer BYTE = new StringKeyAnalyzer(Byte.SIZE);
|
||||
|
||||
public static final StringKeyAnalyzer INSTANCE = CHAR;
|
||||
|
||||
private final int size;
|
||||
|
||||
private final int msb;
|
||||
|
||||
private StringKeyAnalyzer(int size) {
|
||||
this(size, 1 << size - 1);
|
||||
}
|
||||
|
||||
private StringKeyAnalyzer(int size, int msb) {
|
||||
this.size = size;
|
||||
this.msb = msb;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a bit mask where the given bit is set
|
||||
*/
|
||||
private int mask(int bit) {
|
||||
return msb >>> bit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the {@code char} at the given index.
|
||||
*/
|
||||
private char valueAt(String value, int index) {
|
||||
if (index < value.length()) {
|
||||
char ch = value.charAt(index);
|
||||
if (size == Byte.SIZE) {
|
||||
ch &= 0xFF;
|
||||
}
|
||||
return ch;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int lengthInBits(String key) {
|
||||
return key.length() * size;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBitSet(String key, int bitIndex) {
|
||||
if (bitIndex >= lengthInBits(key)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
int index = bitIndex / size;
|
||||
int bit = bitIndex % size;
|
||||
|
||||
return (key.charAt(index) & mask(bit)) != 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPrefix(String key, String prefix) {
|
||||
return key.startsWith(prefix);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int bitIndex(String key, String otherKey) {
|
||||
|
||||
boolean allNull = true;
|
||||
int length = Math.max(key.length(), otherKey.length());
|
||||
|
||||
for (int i = 0; i < length; i++) {
|
||||
|
||||
char ch1 = valueAt(key, i);
|
||||
char ch2 = valueAt(otherKey, i);
|
||||
|
||||
if (ch1 != ch2) {
|
||||
int xor = ch1 ^ ch2;
|
||||
for (int j = 0; j < size; j++) {
|
||||
if ((xor & mask(j)) != 0) {
|
||||
return (i * size) + j;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (ch1 != 0) {
|
||||
allNull = false;
|
||||
}
|
||||
}
|
||||
|
||||
// All bits are 0
|
||||
if (allNull) {
|
||||
return KeyAnalyzer.NULL_BIT_KEY;
|
||||
}
|
||||
|
||||
// Both keys are equal
|
||||
return KeyAnalyzer.EQUAL_BIT_KEY;
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load diff
5
datastructures-validation/build.gradle
Normal file
5
datastructures-validation/build.gradle
Normal file
|
@ -0,0 +1,5 @@
|
|||
dependencies {
|
||||
api "org.xbib:jsr-305:${project.property('jsr305.version')}"
|
||||
testImplementation "org.assertj:assertj-core:${project.property('assertj.version')}"
|
||||
testImplementation "com.google.testing.compile:compile-testing:${project.property('google-testing.version')}"
|
||||
}
|
4
datastructures-validation/src/main/java/module-info.java
Normal file
4
datastructures-validation/src/main/java/module-info.java
Normal file
|
@ -0,0 +1,4 @@
|
|||
module org.xbib.datastructures.validation {
|
||||
requires org.xbib.annotation;
|
||||
requires java.compiler;
|
||||
}
|
|
@ -0,0 +1,117 @@
|
|||
package org.xbib.datastructures.validation.arguments;
|
||||
|
||||
import org.xbib.datastructures.validation.jsr305.Nullable;
|
||||
|
||||
public final class Arguments {
|
||||
public static <A1> Arguments1<A1> of(@Nullable A1 arg1) {
|
||||
return new Arguments1<>(arg1);
|
||||
}
|
||||
|
||||
public static <A1, A2> Arguments2<A1, A2> of(@Nullable A1 arg1, @Nullable A2 arg2) {
|
||||
return new Arguments2<>(arg1, arg2);
|
||||
}
|
||||
|
||||
public static <A1, A2, A3> Arguments3<A1, A2, A3> of(@Nullable A1 arg1,
|
||||
@Nullable A2 arg2, @Nullable A3 arg3) {
|
||||
return new Arguments3<>(arg1, arg2, arg3);
|
||||
}
|
||||
|
||||
public static <A1, A2, A3, A4> Arguments4<A1, A2, A3, A4> of(@Nullable A1 arg1,
|
||||
@Nullable A2 arg2, @Nullable A3 arg3, @Nullable A4 arg4) {
|
||||
return new Arguments4<>(arg1, arg2, arg3, arg4);
|
||||
}
|
||||
|
||||
public static <A1, A2, A3, A4, A5> Arguments5<A1, A2, A3, A4, A5> of(
|
||||
@Nullable A1 arg1, @Nullable A2 arg2, @Nullable A3 arg3, @Nullable A4 arg4,
|
||||
@Nullable A5 arg5) {
|
||||
return new Arguments5<>(arg1, arg2, arg3, arg4, arg5);
|
||||
}
|
||||
|
||||
public static <A1, A2, A3, A4, A5, A6> Arguments6<A1, A2, A3, A4, A5, A6> of(
|
||||
@Nullable A1 arg1, @Nullable A2 arg2, @Nullable A3 arg3, @Nullable A4 arg4,
|
||||
@Nullable A5 arg5, @Nullable A6 arg6) {
|
||||
return new Arguments6<>(arg1, arg2, arg3, arg4, arg5, arg6);
|
||||
}
|
||||
|
||||
public static <A1, A2, A3, A4, A5, A6, A7> Arguments7<A1, A2, A3, A4, A5, A6, A7> of(
|
||||
@Nullable A1 arg1, @Nullable A2 arg2, @Nullable A3 arg3, @Nullable A4 arg4,
|
||||
@Nullable A5 arg5, @Nullable A6 arg6, @Nullable A7 arg7) {
|
||||
return new Arguments7<>(arg1, arg2, arg3, arg4, arg5, arg6, arg7);
|
||||
}
|
||||
|
||||
public static <A1, A2, A3, A4, A5, A6, A7, A8> Arguments8<A1, A2, A3, A4, A5, A6, A7, A8> of(
|
||||
@Nullable A1 arg1, @Nullable A2 arg2, @Nullable A3 arg3, @Nullable A4 arg4,
|
||||
@Nullable A5 arg5, @Nullable A6 arg6, @Nullable A7 arg7, @Nullable A8 arg8) {
|
||||
return new Arguments8<>(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8);
|
||||
}
|
||||
|
||||
public static <A1, A2, A3, A4, A5, A6, A7, A8, A9> Arguments9<A1, A2, A3, A4, A5, A6, A7, A8, A9> of(
|
||||
@Nullable A1 arg1, @Nullable A2 arg2, @Nullable A3 arg3, @Nullable A4 arg4,
|
||||
@Nullable A5 arg5, @Nullable A6 arg6, @Nullable A7 arg7, @Nullable A8 arg8,
|
||||
@Nullable A9 arg9) {
|
||||
return new Arguments9<>(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9);
|
||||
}
|
||||
|
||||
public static <A1, A2, A3, A4, A5, A6, A7, A8, A9, A10> Arguments10<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10> of(
|
||||
@Nullable A1 arg1, @Nullable A2 arg2, @Nullable A3 arg3, @Nullable A4 arg4,
|
||||
@Nullable A5 arg5, @Nullable A6 arg6, @Nullable A7 arg7, @Nullable A8 arg8,
|
||||
@Nullable A9 arg9, @Nullable A10 arg10) {
|
||||
return new Arguments10<>(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9,
|
||||
arg10);
|
||||
}
|
||||
|
||||
public static <A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11> Arguments11<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11> of(
|
||||
@Nullable A1 arg1, @Nullable A2 arg2, @Nullable A3 arg3, @Nullable A4 arg4,
|
||||
@Nullable A5 arg5, @Nullable A6 arg6, @Nullable A7 arg7, @Nullable A8 arg8,
|
||||
@Nullable A9 arg9, @Nullable A10 arg10, @Nullable A11 arg11) {
|
||||
return new Arguments11<>(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9,
|
||||
arg10, arg11);
|
||||
}
|
||||
|
||||
public static <A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12> Arguments12<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12> of(
|
||||
@Nullable A1 arg1, @Nullable A2 arg2, @Nullable A3 arg3, @Nullable A4 arg4,
|
||||
@Nullable A5 arg5, @Nullable A6 arg6, @Nullable A7 arg7, @Nullable A8 arg8,
|
||||
@Nullable A9 arg9, @Nullable A10 arg10, @Nullable A11 arg11,
|
||||
@Nullable A12 arg12) {
|
||||
return new Arguments12<>(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9,
|
||||
arg10, arg11, arg12);
|
||||
}
|
||||
|
||||
public static <A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13> Arguments13<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13> of(
|
||||
@Nullable A1 arg1, @Nullable A2 arg2, @Nullable A3 arg3, @Nullable A4 arg4,
|
||||
@Nullable A5 arg5, @Nullable A6 arg6, @Nullable A7 arg7, @Nullable A8 arg8,
|
||||
@Nullable A9 arg9, @Nullable A10 arg10, @Nullable A11 arg11,
|
||||
@Nullable A12 arg12, @Nullable A13 arg13) {
|
||||
return new Arguments13<>(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9,
|
||||
arg10, arg11, arg12, arg13);
|
||||
}
|
||||
|
||||
public static <A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14> Arguments14<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14> of(
|
||||
@Nullable A1 arg1, @Nullable A2 arg2, @Nullable A3 arg3, @Nullable A4 arg4,
|
||||
@Nullable A5 arg5, @Nullable A6 arg6, @Nullable A7 arg7, @Nullable A8 arg8,
|
||||
@Nullable A9 arg9, @Nullable A10 arg10, @Nullable A11 arg11,
|
||||
@Nullable A12 arg12, @Nullable A13 arg13, @Nullable A14 arg14) {
|
||||
return new Arguments14<>(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9,
|
||||
arg10, arg11, arg12, arg13, arg14);
|
||||
}
|
||||
|
||||
public static <A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15> Arguments15<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15> of(
|
||||
@Nullable A1 arg1, @Nullable A2 arg2, @Nullable A3 arg3, @Nullable A4 arg4,
|
||||
@Nullable A5 arg5, @Nullable A6 arg6, @Nullable A7 arg7, @Nullable A8 arg8,
|
||||
@Nullable A9 arg9, @Nullable A10 arg10, @Nullable A11 arg11,
|
||||
@Nullable A12 arg12, @Nullable A13 arg13, @Nullable A14 arg14,
|
||||
@Nullable A15 arg15) {
|
||||
return new Arguments15<>(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9,
|
||||
arg10, arg11, arg12, arg13, arg14, arg15);
|
||||
}
|
||||
|
||||
public static <A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16> Arguments16<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16> of(
|
||||
@Nullable A1 arg1, @Nullable A2 arg2, @Nullable A3 arg3, @Nullable A4 arg4,
|
||||
@Nullable A5 arg5, @Nullable A6 arg6, @Nullable A7 arg7, @Nullable A8 arg8,
|
||||
@Nullable A9 arg9, @Nullable A10 arg10, @Nullable A11 arg11,
|
||||
@Nullable A12 arg12, @Nullable A13 arg13, @Nullable A14 arg14,
|
||||
@Nullable A15 arg15, @Nullable A16 arg16) {
|
||||
return new Arguments16<>(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9,
|
||||
arg10, arg11, arg12, arg13, arg14, arg15, arg16);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
package org.xbib.datastructures.validation.arguments;
|
||||
|
||||
import org.xbib.datastructures.validation.fn.Function1;
|
||||
import org.xbib.datastructures.validation.jsr305.Nullable;
|
||||
|
||||
public class Arguments1<A1> {
|
||||
|
||||
protected final A1 arg1;
|
||||
|
||||
Arguments1(@Nullable A1 arg1) {
|
||||
this.arg1 = arg1;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public final A1 arg1() {
|
||||
return this.arg1;
|
||||
}
|
||||
|
||||
public final <X> X map(Function1<? super A1, ? extends X> mapper) {
|
||||
return mapper.apply(arg1);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,47 @@
|
|||
/*
|
||||
* Copyright (C) 2018-2022 Toshiaki Maki <makingx@gmail.com>
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.xbib.datastructures.validation.arguments;
|
||||
|
||||
import org.xbib.datastructures.validation.fn.Function10;
|
||||
import org.xbib.datastructures.validation.jsr305.Nullable;
|
||||
|
||||
/**
|
||||
* Generated by https://github.com/making/yavi/blob/develop/scripts/generate-args.sh
|
||||
*
|
||||
* @since 0.3.0
|
||||
*/
|
||||
public class Arguments10<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10>
|
||||
extends Arguments9<A1, A2, A3, A4, A5, A6, A7, A8, A9> {
|
||||
|
||||
protected final A10 arg10;
|
||||
|
||||
Arguments10(@Nullable A1 arg1, @Nullable A2 arg2, @Nullable A3 arg3,
|
||||
@Nullable A4 arg4, @Nullable A5 arg5, @Nullable A6 arg6, @Nullable A7 arg7,
|
||||
@Nullable A8 arg8, @Nullable A9 arg9, @Nullable A10 arg10) {
|
||||
super(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9);
|
||||
this.arg10 = arg10;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public final A10 arg10() {
|
||||
return this.arg10;
|
||||
}
|
||||
|
||||
public final <X> X map(
|
||||
Function10<? super A1, ? super A2, ? super A3, ? super A4, ? super A5, ? super A6, ? super A7, ? super A8, ? super A9, ? super A10, ? extends X> mapper) {
|
||||
return mapper.apply(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,89 @@
|
|||
/*
|
||||
* Copyright (C) 2018-2022 Toshiaki Maki <makingx@gmail.com>
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.xbib.datastructures.validation.arguments;
|
||||
|
||||
import org.xbib.datastructures.validation.core.ValueValidator;
|
||||
import org.xbib.datastructures.validation.fn.Function10;
|
||||
import org.xbib.datastructures.validation.fn.Validations;
|
||||
|
||||
/**
|
||||
* Generated by https://github.com/making/yavi/blob/develop/scripts/generate-args.sh
|
||||
*
|
||||
* @since 0.7.0
|
||||
*/
|
||||
public class Arguments10Combining<A, R1, R2, R3, R4, R5, R6, R7, R8, R9, R10> {
|
||||
protected final ValueValidator<? super A, ? extends R1> v1;
|
||||
|
||||
protected final ValueValidator<? super A, ? extends R2> v2;
|
||||
|
||||
protected final ValueValidator<? super A, ? extends R3> v3;
|
||||
|
||||
protected final ValueValidator<? super A, ? extends R4> v4;
|
||||
|
||||
protected final ValueValidator<? super A, ? extends R5> v5;
|
||||
|
||||
protected final ValueValidator<? super A, ? extends R6> v6;
|
||||
|
||||
protected final ValueValidator<? super A, ? extends R7> v7;
|
||||
|
||||
protected final ValueValidator<? super A, ? extends R8> v8;
|
||||
|
||||
protected final ValueValidator<? super A, ? extends R9> v9;
|
||||
|
||||
protected final ValueValidator<? super A, ? extends R10> v10;
|
||||
|
||||
public Arguments10Combining(ValueValidator<? super A, ? extends R1> v1,
|
||||
ValueValidator<? super A, ? extends R2> v2,
|
||||
ValueValidator<? super A, ? extends R3> v3,
|
||||
ValueValidator<? super A, ? extends R4> v4,
|
||||
ValueValidator<? super A, ? extends R5> v5,
|
||||
ValueValidator<? super A, ? extends R6> v6,
|
||||
ValueValidator<? super A, ? extends R7> v7,
|
||||
ValueValidator<? super A, ? extends R8> v8,
|
||||
ValueValidator<? super A, ? extends R9> v9,
|
||||
ValueValidator<? super A, ? extends R10> v10) {
|
||||
this.v1 = v1;
|
||||
this.v2 = v2;
|
||||
this.v3 = v3;
|
||||
this.v4 = v4;
|
||||
this.v5 = v5;
|
||||
this.v6 = v6;
|
||||
this.v7 = v7;
|
||||
this.v8 = v8;
|
||||
this.v9 = v9;
|
||||
this.v10 = v10;
|
||||
}
|
||||
|
||||
public <X> Arguments1Validator<A, X> apply(
|
||||
Function10<? super R1, ? super R2, ? super R3, ? super R4, ? super R5, ? super R6, ? super R7, ? super R8, ? super R9, ? super R10, ? extends X> f) {
|
||||
return (a, locale, constraintContext) -> Validations.apply(f::apply,
|
||||
this.v1.validate(a, locale, constraintContext),
|
||||
this.v2.validate(a, locale, constraintContext),
|
||||
this.v3.validate(a, locale, constraintContext),
|
||||
this.v4.validate(a, locale, constraintContext),
|
||||
this.v5.validate(a, locale, constraintContext),
|
||||
this.v6.validate(a, locale, constraintContext),
|
||||
this.v7.validate(a, locale, constraintContext),
|
||||
this.v8.validate(a, locale, constraintContext),
|
||||
this.v9.validate(a, locale, constraintContext),
|
||||
this.v10.validate(a, locale, constraintContext));
|
||||
}
|
||||
|
||||
public <R11> Arguments11Combining<A, R1, R2, R3, R4, R5, R6, R7, R8, R9, R10, R11> combine(
|
||||
ValueValidator<? super A, ? extends R11> v11) {
|
||||
return new Arguments11Combining<>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,90 @@
|
|||
/*
|
||||
* Copyright (C) 2018-2022 Toshiaki Maki <makingx@gmail.com>
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.xbib.datastructures.validation.arguments;
|
||||
|
||||
import org.xbib.datastructures.validation.core.ValueValidator;
|
||||
import org.xbib.datastructures.validation.fn.Function10;
|
||||
import org.xbib.datastructures.validation.fn.Validations;
|
||||
|
||||
/**
|
||||
* Generated by https://github.com/making/yavi/blob/develop/scripts/generate-args.sh
|
||||
*
|
||||
* @since 0.7.0
|
||||
*/
|
||||
public class Arguments10Splitting<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, R1, R2, R3, R4, R5, R6, R7, R8, R9, R10> {
|
||||
protected final ValueValidator<? super A1, ? extends R1> v1;
|
||||
|
||||
protected final ValueValidator<? super A2, ? extends R2> v2;
|
||||
|
||||
protected final ValueValidator<? super A3, ? extends R3> v3;
|
||||
|
||||
protected final ValueValidator<? super A4, ? extends R4> v4;
|
||||
|
||||
protected final ValueValidator<? super A5, ? extends R5> v5;
|
||||
|
||||
protected final ValueValidator<? super A6, ? extends R6> v6;
|
||||
|
||||
protected final ValueValidator<? super A7, ? extends R7> v7;
|
||||
|
||||
protected final ValueValidator<? super A8, ? extends R8> v8;
|
||||
|
||||
protected final ValueValidator<? super A9, ? extends R9> v9;
|
||||
|
||||
protected final ValueValidator<? super A10, ? extends R10> v10;
|
||||
|
||||
public Arguments10Splitting(ValueValidator<? super A1, ? extends R1> v1,
|
||||
ValueValidator<? super A2, ? extends R2> v2,
|
||||
ValueValidator<? super A3, ? extends R3> v3,
|
||||
ValueValidator<? super A4, ? extends R4> v4,
|
||||
ValueValidator<? super A5, ? extends R5> v5,
|
||||
ValueValidator<? super A6, ? extends R6> v6,
|
||||
ValueValidator<? super A7, ? extends R7> v7,
|
||||
ValueValidator<? super A8, ? extends R8> v8,
|
||||
ValueValidator<? super A9, ? extends R9> v9,
|
||||
ValueValidator<? super A10, ? extends R10> v10) {
|
||||
this.v1 = v1;
|
||||
this.v2 = v2;
|
||||
this.v3 = v3;
|
||||
this.v4 = v4;
|
||||
this.v5 = v5;
|
||||
this.v6 = v6;
|
||||
this.v7 = v7;
|
||||
this.v8 = v8;
|
||||
this.v9 = v9;
|
||||
this.v10 = v10;
|
||||
}
|
||||
|
||||
public <X> Arguments10Validator<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, X> apply(
|
||||
Function10<? super R1, ? super R2, ? super R3, ? super R4, ? super R5, ? super R6, ? super R7, ? super R8, ? super R9, ? super R10, ? extends X> f) {
|
||||
return (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, locale,
|
||||
constraintContext) -> Validations.apply(f::apply,
|
||||
this.v1.validate(a1, locale, constraintContext),
|
||||
this.v2.validate(a2, locale, constraintContext),
|
||||
this.v3.validate(a3, locale, constraintContext),
|
||||
this.v4.validate(a4, locale, constraintContext),
|
||||
this.v5.validate(a5, locale, constraintContext),
|
||||
this.v6.validate(a6, locale, constraintContext),
|
||||
this.v7.validate(a7, locale, constraintContext),
|
||||
this.v8.validate(a8, locale, constraintContext),
|
||||
this.v9.validate(a9, locale, constraintContext),
|
||||
this.v10.validate(a10, locale, constraintContext));
|
||||
}
|
||||
|
||||
public <A11, R11> Arguments11Splitting<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, R1, R2, R3, R4, R5, R6, R7, R8, R9, R10, R11> split(
|
||||
ValueValidator<? super A11, ? extends R11> v11) {
|
||||
return new Arguments11Splitting<>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,142 @@
|
|||
/*
|
||||
* Copyright (C) 2018-2022 Toshiaki Maki <makingx@gmail.com>
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.xbib.datastructures.validation.arguments;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import org.xbib.datastructures.validation.core.ConstraintContext;
|
||||
import org.xbib.datastructures.validation.core.ConstraintGroup;
|
||||
import org.xbib.datastructures.validation.core.ConstraintViolationsException;
|
||||
import org.xbib.datastructures.validation.core.Validated;
|
||||
import org.xbib.datastructures.validation.core.ValueValidator;
|
||||
import org.xbib.datastructures.validation.jsr305.Nullable;
|
||||
|
||||
/**
|
||||
* Generated by https://github.com/making/yavi/blob/develop/scripts/generate-args.sh
|
||||
*
|
||||
* @since 0.3.0
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface Arguments10Validator<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, X> {
|
||||
|
||||
Validated<X> validate(@Nullable A1 a1, @Nullable A2 a2, @Nullable A3 a3,
|
||||
@Nullable A4 a4, @Nullable A5 a5, @Nullable A6 a6, @Nullable A7 a7,
|
||||
@Nullable A8 a8, @Nullable A9 a9, @Nullable A10 a10, Locale locale,
|
||||
ConstraintContext constraintContext);
|
||||
|
||||
/**
|
||||
* @since 0.7.0
|
||||
*/
|
||||
default <X2> Arguments10Validator<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, X2> andThen(
|
||||
Function<? super X, ? extends X2> mapper) {
|
||||
return (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, locale,
|
||||
constraintContext) -> Arguments10Validator.this.validate(a1, a2, a3, a4,
|
||||
a5, a6, a7, a8, a9, a10, locale, constraintContext).map(mapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 0.11.0
|
||||
*/
|
||||
default <X2> Arguments10Validator<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, X2> andThen(
|
||||
ValueValidator<? super X, X2> validator) {
|
||||
return (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, locale,
|
||||
constraintContext) -> Arguments10Validator.this
|
||||
.validate(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, locale,
|
||||
constraintContext)
|
||||
.flatMap(v -> validator.validate(v, locale, constraintContext));
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 0.7.0
|
||||
*/
|
||||
default <A> Arguments1Validator<A, X> compose(
|
||||
Function<? super A, ? extends Arguments10<? extends A1, ? extends A2, ? extends A3, ? extends A4, ? extends A5, ? extends A6, ? extends A7, ? extends A8, ? extends A9, ? extends A10>> mapper) {
|
||||
return (a, locale, constraintContext) -> {
|
||||
final Arguments10<? extends A1, ? extends A2, ? extends A3, ? extends A4, ? extends A5, ? extends A6, ? extends A7, ? extends A8, ? extends A9, ? extends A10> args = mapper
|
||||
.apply(a);
|
||||
return Arguments10Validator.this.validate(args.arg1(), args.arg2(),
|
||||
args.arg3(), args.arg4(), args.arg5(), args.arg6(), args.arg7(),
|
||||
args.arg8(), args.arg9(), args.arg10(), locale, constraintContext);
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 0.10.0
|
||||
*/
|
||||
default Arguments10Validator<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, Supplier<X>> lazy() {
|
||||
// WARNING:: The default implementation is not really lazy!
|
||||
return this.andThen(x -> () -> x);
|
||||
}
|
||||
|
||||
default Validated<X> validate(@Nullable A1 a1, @Nullable A2 a2, @Nullable A3 a3,
|
||||
@Nullable A4 a4, @Nullable A5 a5, @Nullable A6 a6, @Nullable A7 a7,
|
||||
@Nullable A8 a8, @Nullable A9 a9, @Nullable A10 a10) {
|
||||
return this.validate(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, Locale.getDefault(),
|
||||
ConstraintGroup.DEFAULT);
|
||||
}
|
||||
|
||||
default Validated<X> validate(@Nullable A1 a1, @Nullable A2 a2, @Nullable A3 a3,
|
||||
@Nullable A4 a4, @Nullable A5 a5, @Nullable A6 a6, @Nullable A7 a7,
|
||||
@Nullable A8 a8, @Nullable A9 a9, @Nullable A10 a10,
|
||||
ConstraintContext constraintContext) {
|
||||
return this.validate(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, Locale.getDefault(),
|
||||
constraintContext);
|
||||
}
|
||||
|
||||
default Validated<X> validate(@Nullable A1 a1, @Nullable A2 a2, @Nullable A3 a3,
|
||||
@Nullable A4 a4, @Nullable A5 a5, @Nullable A6 a6, @Nullable A7 a7,
|
||||
@Nullable A8 a8, @Nullable A9 a9, @Nullable A10 a10, Locale locale) {
|
||||
return this.validate(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, locale,
|
||||
ConstraintGroup.DEFAULT);
|
||||
}
|
||||
|
||||
default X validated(@Nullable A1 a1, @Nullable A2 a2, @Nullable A3 a3,
|
||||
@Nullable A4 a4, @Nullable A5 a5, @Nullable A6 a6, @Nullable A7 a7,
|
||||
@Nullable A8 a8, @Nullable A9 a9, @Nullable A10 a10)
|
||||
throws ConstraintViolationsException {
|
||||
return this.validate(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10)
|
||||
.orElseThrow(ConstraintViolationsException::new);
|
||||
}
|
||||
|
||||
default X validated(@Nullable A1 a1, @Nullable A2 a2, @Nullable A3 a3,
|
||||
@Nullable A4 a4, @Nullable A5 a5, @Nullable A6 a6, @Nullable A7 a7,
|
||||
@Nullable A8 a8, @Nullable A9 a9, @Nullable A10 a10,
|
||||
ConstraintContext constraintContext) throws ConstraintViolationsException {
|
||||
return this.validate(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, constraintContext)
|
||||
.orElseThrow(ConstraintViolationsException::new);
|
||||
}
|
||||
|
||||
default X validated(@Nullable A1 a1, @Nullable A2 a2, @Nullable A3 a3,
|
||||
@Nullable A4 a4, @Nullable A5 a5, @Nullable A6 a6, @Nullable A7 a7,
|
||||
@Nullable A8 a8, @Nullable A9 a9, @Nullable A10 a10, Locale locale)
|
||||
throws ConstraintViolationsException {
|
||||
return this.validate(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, locale)
|
||||
.orElseThrow(ConstraintViolationsException::new);
|
||||
}
|
||||
|
||||
default X validated(@Nullable A1 a1, @Nullable A2 a2, @Nullable A3 a3,
|
||||
@Nullable A4 a4, @Nullable A5 a5, @Nullable A6 a6, @Nullable A7 a7,
|
||||
@Nullable A8 a8, @Nullable A9 a9, @Nullable A10 a10, Locale locale,
|
||||
ConstraintContext constraintContext) throws ConstraintViolationsException {
|
||||
return this
|
||||
.validate(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, locale,
|
||||
constraintContext)
|
||||
.orElseThrow(ConstraintViolationsException::new);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,49 @@
|
|||
/*
|
||||
* Copyright (C) 2018-2022 Toshiaki Maki <makingx@gmail.com>
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.xbib.datastructures.validation.arguments;
|
||||
|
||||
import org.xbib.datastructures.validation.fn.Function11;
|
||||
import org.xbib.datastructures.validation.jsr305.Nullable;
|
||||
|
||||
/**
|
||||
* Generated by https://github.com/making/yavi/blob/develop/scripts/generate-args.sh
|
||||
*
|
||||
* @since 0.3.0
|
||||
*/
|
||||
public class Arguments11<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11>
|
||||
extends Arguments10<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10> {
|
||||
|
||||
protected final A11 arg11;
|
||||
|
||||
Arguments11(@Nullable A1 arg1, @Nullable A2 arg2, @Nullable A3 arg3,
|
||||
@Nullable A4 arg4, @Nullable A5 arg5, @Nullable A6 arg6, @Nullable A7 arg7,
|
||||
@Nullable A8 arg8, @Nullable A9 arg9, @Nullable A10 arg10,
|
||||
@Nullable A11 arg11) {
|
||||
super(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10);
|
||||
this.arg11 = arg11;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public final A11 arg11() {
|
||||
return this.arg11;
|
||||
}
|
||||
|
||||
public final <X> X map(
|
||||
Function11<? super A1, ? super A2, ? super A3, ? super A4, ? super A5, ? super A6, ? super A7, ? super A8, ? super A9, ? super A10, ? super A11, ? extends X> mapper) {
|
||||
return mapper.apply(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10,
|
||||
arg11);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,95 @@
|
|||
/*
|
||||
* Copyright (C) 2018-2022 Toshiaki Maki <makingx@gmail.com>
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.xbib.datastructures.validation.arguments;
|
||||
|
||||
import org.xbib.datastructures.validation.core.ValueValidator;
|
||||
import org.xbib.datastructures.validation.fn.Function11;
|
||||
import org.xbib.datastructures.validation.fn.Validations;
|
||||
|
||||
/**
|
||||
* Generated by https://github.com/making/yavi/blob/develop/scripts/generate-args.sh
|
||||
*
|
||||
* @since 0.7.0
|
||||
*/
|
||||
public class Arguments11Combining<A, R1, R2, R3, R4, R5, R6, R7, R8, R9, R10, R11> {
|
||||
protected final ValueValidator<? super A, ? extends R1> v1;
|
||||
|
||||
protected final ValueValidator<? super A, ? extends R2> v2;
|
||||
|
||||
protected final ValueValidator<? super A, ? extends R3> v3;
|
||||
|
||||
protected final ValueValidator<? super A, ? extends R4> v4;
|
||||
|
||||
protected final ValueValidator<? super A, ? extends R5> v5;
|
||||
|
||||
protected final ValueValidator<? super A, ? extends R6> v6;
|
||||
|
||||
protected final ValueValidator<? super A, ? extends R7> v7;
|
||||
|
||||
protected final ValueValidator<? super A, ? extends R8> v8;
|
||||
|
||||
protected final ValueValidator<? super A, ? extends R9> v9;
|
||||
|
||||
protected final ValueValidator<? super A, ? extends R10> v10;
|
||||
|
||||
protected final ValueValidator<? super A, ? extends R11> v11;
|
||||
|
||||
public Arguments11Combining(ValueValidator<? super A, ? extends R1> v1,
|
||||
ValueValidator<? super A, ? extends R2> v2,
|
||||
ValueValidator<? super A, ? extends R3> v3,
|
||||
ValueValidator<? super A, ? extends R4> v4,
|
||||
ValueValidator<? super A, ? extends R5> v5,
|
||||
ValueValidator<? super A, ? extends R6> v6,
|
||||
ValueValidator<? super A, ? extends R7> v7,
|
||||
ValueValidator<? super A, ? extends R8> v8,
|
||||
ValueValidator<? super A, ? extends R9> v9,
|
||||
ValueValidator<? super A, ? extends R10> v10,
|
||||
ValueValidator<? super A, ? extends R11> v11) {
|
||||
this.v1 = v1;
|
||||
this.v2 = v2;
|
||||
this.v3 = v3;
|
||||
this.v4 = v4;
|
||||
this.v5 = v5;
|
||||
this.v6 = v6;
|
||||
this.v7 = v7;
|
||||
this.v8 = v8;
|
||||
this.v9 = v9;
|
||||
this.v10 = v10;
|
||||
this.v11 = v11;
|
||||
}
|
||||
|
||||
public <X> Arguments1Validator<A, X> apply(
|
||||
Function11<? super R1, ? super R2, ? super R3, ? super R4, ? super R5, ? super R6, ? super R7, ? super R8, ? super R9, ? super R10, ? super R11, ? extends X> f) {
|
||||
return (a, locale, constraintContext) -> Validations.apply(f::apply,
|
||||
this.v1.validate(a, locale, constraintContext),
|
||||
this.v2.validate(a, locale, constraintContext),
|
||||
this.v3.validate(a, locale, constraintContext),
|
||||
this.v4.validate(a, locale, constraintContext),
|
||||
this.v5.validate(a, locale, constraintContext),
|
||||
this.v6.validate(a, locale, constraintContext),
|
||||
this.v7.validate(a, locale, constraintContext),
|
||||
this.v8.validate(a, locale, constraintContext),
|
||||
this.v9.validate(a, locale, constraintContext),
|
||||
this.v10.validate(a, locale, constraintContext),
|
||||
this.v11.validate(a, locale, constraintContext));
|
||||
}
|
||||
|
||||
public <R12> Arguments12Combining<A, R1, R2, R3, R4, R5, R6, R7, R8, R9, R10, R11, R12> combine(
|
||||
ValueValidator<? super A, ? extends R12> v12) {
|
||||
return new Arguments12Combining<>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11,
|
||||
v12);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,96 @@
|
|||
/*
|
||||
* Copyright (C) 2018-2022 Toshiaki Maki <makingx@gmail.com>
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.xbib.datastructures.validation.arguments;
|
||||
|
||||
import org.xbib.datastructures.validation.core.ValueValidator;
|
||||
import org.xbib.datastructures.validation.fn.Function11;
|
||||
import org.xbib.datastructures.validation.fn.Validations;
|
||||
|
||||
/**
|
||||
* Generated by https://github.com/making/yavi/blob/develop/scripts/generate-args.sh
|
||||
*
|
||||
* @since 0.7.0
|
||||
*/
|
||||
public class Arguments11Splitting<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, R1, R2, R3, R4, R5, R6, R7, R8, R9, R10, R11> {
|
||||
protected final ValueValidator<? super A1, ? extends R1> v1;
|
||||
|
||||
protected final ValueValidator<? super A2, ? extends R2> v2;
|
||||
|
||||
protected final ValueValidator<? super A3, ? extends R3> v3;
|
||||
|
||||
protected final ValueValidator<? super A4, ? extends R4> v4;
|
||||
|
||||
protected final ValueValidator<? super A5, ? extends R5> v5;
|
||||
|
||||
protected final ValueValidator<? super A6, ? extends R6> v6;
|
||||
|
||||
protected final ValueValidator<? super A7, ? extends R7> v7;
|
||||
|
||||
protected final ValueValidator<? super A8, ? extends R8> v8;
|
||||
|
||||
protected final ValueValidator<? super A9, ? extends R9> v9;
|
||||
|
||||
protected final ValueValidator<? super A10, ? extends R10> v10;
|
||||
|
||||
protected final ValueValidator<? super A11, ? extends R11> v11;
|
||||
|
||||
public Arguments11Splitting(ValueValidator<? super A1, ? extends R1> v1,
|
||||
ValueValidator<? super A2, ? extends R2> v2,
|
||||
ValueValidator<? super A3, ? extends R3> v3,
|
||||
ValueValidator<? super A4, ? extends R4> v4,
|
||||
ValueValidator<? super A5, ? extends R5> v5,
|
||||
ValueValidator<? super A6, ? extends R6> v6,
|
||||
ValueValidator<? super A7, ? extends R7> v7,
|
||||
ValueValidator<? super A8, ? extends R8> v8,
|
||||
ValueValidator<? super A9, ? extends R9> v9,
|
||||
ValueValidator<? super A10, ? extends R10> v10,
|
||||
ValueValidator<? super A11, ? extends R11> v11) {
|
||||
this.v1 = v1;
|
||||
this.v2 = v2;
|
||||
this.v3 = v3;
|
||||
this.v4 = v4;
|
||||
this.v5 = v5;
|
||||
this.v6 = v6;
|
||||
this.v7 = v7;
|
||||
this.v8 = v8;
|
||||
this.v9 = v9;
|
||||
this.v10 = v10;
|
||||
this.v11 = v11;
|
||||
}
|
||||
|
||||
public <X> Arguments11Validator<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, X> apply(
|
||||
Function11<? super R1, ? super R2, ? super R3, ? super R4, ? super R5, ? super R6, ? super R7, ? super R8, ? super R9, ? super R10, ? super R11, ? extends X> f) {
|
||||
return (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, locale,
|
||||
constraintContext) -> Validations.apply(f::apply,
|
||||
this.v1.validate(a1, locale, constraintContext),
|
||||
this.v2.validate(a2, locale, constraintContext),
|
||||
this.v3.validate(a3, locale, constraintContext),
|
||||
this.v4.validate(a4, locale, constraintContext),
|
||||
this.v5.validate(a5, locale, constraintContext),
|
||||
this.v6.validate(a6, locale, constraintContext),
|
||||
this.v7.validate(a7, locale, constraintContext),
|
||||
this.v8.validate(a8, locale, constraintContext),
|
||||
this.v9.validate(a9, locale, constraintContext),
|
||||
this.v10.validate(a10, locale, constraintContext),
|
||||
this.v11.validate(a11, locale, constraintContext));
|
||||
}
|
||||
|
||||
public <A12, R12> Arguments12Splitting<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, R1, R2, R3, R4, R5, R6, R7, R8, R9, R10, R11, R12> split(
|
||||
ValueValidator<? super A12, ? extends R12> v12) {
|
||||
return new Arguments12Splitting<>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11,
|
||||
v12);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,147 @@
|
|||
/*
|
||||
* Copyright (C) 2018-2022 Toshiaki Maki <makingx@gmail.com>
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.xbib.datastructures.validation.arguments;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import org.xbib.datastructures.validation.core.ConstraintContext;
|
||||
import org.xbib.datastructures.validation.core.ConstraintGroup;
|
||||
import org.xbib.datastructures.validation.core.ConstraintViolationsException;
|
||||
import org.xbib.datastructures.validation.core.Validated;
|
||||
import org.xbib.datastructures.validation.core.ValueValidator;
|
||||
import org.xbib.datastructures.validation.jsr305.Nullable;
|
||||
|
||||
/**
|
||||
* Generated by https://github.com/making/yavi/blob/develop/scripts/generate-args.sh
|
||||
*
|
||||
* @since 0.3.0
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface Arguments11Validator<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, X> {
|
||||
|
||||
Validated<X> validate(@Nullable A1 a1, @Nullable A2 a2, @Nullable A3 a3,
|
||||
@Nullable A4 a4, @Nullable A5 a5, @Nullable A6 a6, @Nullable A7 a7,
|
||||
@Nullable A8 a8, @Nullable A9 a9, @Nullable A10 a10, @Nullable A11 a11,
|
||||
Locale locale, ConstraintContext constraintContext);
|
||||
|
||||
/**
|
||||
* @since 0.7.0
|
||||
*/
|
||||
default <X2> Arguments11Validator<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, X2> andThen(
|
||||
Function<? super X, ? extends X2> mapper) {
|
||||
return (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, locale,
|
||||
constraintContext) -> Arguments11Validator.this.validate(a1, a2, a3, a4,
|
||||
a5, a6, a7, a8, a9, a10, a11, locale, constraintContext)
|
||||
.map(mapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 0.11.0
|
||||
*/
|
||||
default <X2> Arguments11Validator<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, X2> andThen(
|
||||
ValueValidator<? super X, X2> validator) {
|
||||
return (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, locale,
|
||||
constraintContext) -> Arguments11Validator.this
|
||||
.validate(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, locale,
|
||||
constraintContext)
|
||||
.flatMap(v -> validator.validate(v, locale, constraintContext));
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 0.7.0
|
||||
*/
|
||||
default <A> Arguments1Validator<A, X> compose(
|
||||
Function<? super A, ? extends Arguments11<? extends A1, ? extends A2, ? extends A3, ? extends A4, ? extends A5, ? extends A6, ? extends A7, ? extends A8, ? extends A9, ? extends A10, ? extends A11>> mapper) {
|
||||
return (a, locale, constraintContext) -> {
|
||||
final Arguments11<? extends A1, ? extends A2, ? extends A3, ? extends A4, ? extends A5, ? extends A6, ? extends A7, ? extends A8, ? extends A9, ? extends A10, ? extends A11> args = mapper
|
||||
.apply(a);
|
||||
return Arguments11Validator.this.validate(args.arg1(), args.arg2(),
|
||||
args.arg3(), args.arg4(), args.arg5(), args.arg6(), args.arg7(),
|
||||
args.arg8(), args.arg9(), args.arg10(), args.arg11(), locale,
|
||||
constraintContext);
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 0.10.0
|
||||
*/
|
||||
default Arguments11Validator<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, Supplier<X>> lazy() {
|
||||
// WARNING:: The default implementation is not really lazy!
|
||||
return this.andThen(x -> () -> x);
|
||||
}
|
||||
|
||||
default Validated<X> validate(@Nullable A1 a1, @Nullable A2 a2, @Nullable A3 a3,
|
||||
@Nullable A4 a4, @Nullable A5 a5, @Nullable A6 a6, @Nullable A7 a7,
|
||||
@Nullable A8 a8, @Nullable A9 a9, @Nullable A10 a10, @Nullable A11 a11) {
|
||||
return this.validate(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11,
|
||||
Locale.getDefault(), ConstraintGroup.DEFAULT);
|
||||
}
|
||||
|
||||
default Validated<X> validate(@Nullable A1 a1, @Nullable A2 a2, @Nullable A3 a3,
|
||||
@Nullable A4 a4, @Nullable A5 a5, @Nullable A6 a6, @Nullable A7 a7,
|
||||
@Nullable A8 a8, @Nullable A9 a9, @Nullable A10 a10, @Nullable A11 a11,
|
||||
ConstraintContext constraintContext) {
|
||||
return this.validate(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11,
|
||||
Locale.getDefault(), constraintContext);
|
||||
}
|
||||
|
||||
default Validated<X> validate(@Nullable A1 a1, @Nullable A2 a2, @Nullable A3 a3,
|
||||
@Nullable A4 a4, @Nullable A5 a5, @Nullable A6 a6, @Nullable A7 a7,
|
||||
@Nullable A8 a8, @Nullable A9 a9, @Nullable A10 a10, @Nullable A11 a11,
|
||||
Locale locale) {
|
||||
return this.validate(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, locale,
|
||||
ConstraintGroup.DEFAULT);
|
||||
}
|
||||
|
||||
default X validated(@Nullable A1 a1, @Nullable A2 a2, @Nullable A3 a3,
|
||||
@Nullable A4 a4, @Nullable A5 a5, @Nullable A6 a6, @Nullable A7 a7,
|
||||
@Nullable A8 a8, @Nullable A9 a9, @Nullable A10 a10, @Nullable A11 a11)
|
||||
throws ConstraintViolationsException {
|
||||
return this.validate(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11)
|
||||
.orElseThrow(ConstraintViolationsException::new);
|
||||
}
|
||||
|
||||
default X validated(@Nullable A1 a1, @Nullable A2 a2, @Nullable A3 a3,
|
||||
@Nullable A4 a4, @Nullable A5 a5, @Nullable A6 a6, @Nullable A7 a7,
|
||||
@Nullable A8 a8, @Nullable A9 a9, @Nullable A10 a10, @Nullable A11 a11,
|
||||
ConstraintContext constraintContext) throws ConstraintViolationsException {
|
||||
return this
|
||||
.validate(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, constraintContext)
|
||||
.orElseThrow(ConstraintViolationsException::new);
|
||||
}
|
||||
|
||||
default X validated(@Nullable A1 a1, @Nullable A2 a2, @Nullable A3 a3,
|
||||
@Nullable A4 a4, @Nullable A5 a5, @Nullable A6 a6, @Nullable A7 a7,
|
||||
@Nullable A8 a8, @Nullable A9 a9, @Nullable A10 a10, @Nullable A11 a11,
|
||||
Locale locale) throws ConstraintViolationsException {
|
||||
return this.validate(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, locale)
|
||||
.orElseThrow(ConstraintViolationsException::new);
|
||||
}
|
||||
|
||||
default X validated(@Nullable A1 a1, @Nullable A2 a2, @Nullable A3 a3,
|
||||
@Nullable A4 a4, @Nullable A5 a5, @Nullable A6 a6, @Nullable A7 a7,
|
||||
@Nullable A8 a8, @Nullable A9 a9, @Nullable A10 a10, @Nullable A11 a11,
|
||||
Locale locale, ConstraintContext constraintContext)
|
||||
throws ConstraintViolationsException {
|
||||
return this
|
||||
.validate(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, locale,
|
||||
constraintContext)
|
||||
.orElseThrow(ConstraintViolationsException::new);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,49 @@
|
|||
/*
|
||||
* Copyright (C) 2018-2022 Toshiaki Maki <makingx@gmail.com>
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.xbib.datastructures.validation.arguments;
|
||||
|
||||
import org.xbib.datastructures.validation.fn.Function12;
|
||||
import org.xbib.datastructures.validation.jsr305.Nullable;
|
||||
|
||||
/**
|
||||
* Generated by https://github.com/making/yavi/blob/develop/scripts/generate-args.sh
|
||||
*
|
||||
* @since 0.3.0
|
||||
*/
|
||||
public class Arguments12<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12>
|
||||
extends Arguments11<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11> {
|
||||
|
||||
protected final A12 arg12;
|
||||
|
||||
Arguments12(@Nullable A1 arg1, @Nullable A2 arg2, @Nullable A3 arg3,
|
||||
@Nullable A4 arg4, @Nullable A5 arg5, @Nullable A6 arg6, @Nullable A7 arg7,
|
||||
@Nullable A8 arg8, @Nullable A9 arg9, @Nullable A10 arg10,
|
||||
@Nullable A11 arg11, @Nullable A12 arg12) {
|
||||
super(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11);
|
||||
this.arg12 = arg12;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public final A12 arg12() {
|
||||
return this.arg12;
|
||||
}
|
||||
|
||||
public final <X> X map(
|
||||
Function12<? super A1, ? super A2, ? super A3, ? super A4, ? super A5, ? super A6, ? super A7, ? super A8, ? super A9, ? super A10, ? super A11, ? super A12, ? extends X> mapper) {
|
||||
return mapper.apply(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10,
|
||||
arg11, arg12);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,100 @@
|
|||
/*
|
||||
* Copyright (C) 2018-2022 Toshiaki Maki <makingx@gmail.com>
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.xbib.datastructures.validation.arguments;
|
||||
|
||||
import org.xbib.datastructures.validation.core.ValueValidator;
|
||||
import org.xbib.datastructures.validation.fn.Function12;
|
||||
import org.xbib.datastructures.validation.fn.Validations;
|
||||
|
||||
/**
|
||||
* Generated by https://github.com/making/yavi/blob/develop/scripts/generate-args.sh
|
||||
*
|
||||
* @since 0.7.0
|
||||
*/
|
||||
public class Arguments12Combining<A, R1, R2, R3, R4, R5, R6, R7, R8, R9, R10, R11, R12> {
|
||||
protected final ValueValidator<? super A, ? extends R1> v1;
|
||||
|
||||
protected final ValueValidator<? super A, ? extends R2> v2;
|
||||
|
||||
protected final ValueValidator<? super A, ? extends R3> v3;
|
||||
|
||||
protected final ValueValidator<? super A, ? extends R4> v4;
|
||||
|
||||
protected final ValueValidator<? super A, ? extends R5> v5;
|
||||
|
||||
protected final ValueValidator<? super A, ? extends R6> v6;
|
||||
|
||||
protected final ValueValidator<? super A, ? extends R7> v7;
|
||||
|
||||
protected final ValueValidator<? super A, ? extends R8> v8;
|
||||
|
||||
protected final ValueValidator<? super A, ? extends R9> v9;
|
||||
|
||||
protected final ValueValidator<? super A, ? extends R10> v10;
|
||||
|
||||
protected final ValueValidator<? super A, ? extends R11> v11;
|
||||
|
||||
protected final ValueValidator<? super A, ? extends R12> v12;
|
||||
|
||||
public Arguments12Combining(ValueValidator<? super A, ? extends R1> v1,
|
||||
ValueValidator<? super A, ? extends R2> v2,
|
||||
ValueValidator<? super A, ? extends R3> v3,
|
||||
ValueValidator<? super A, ? extends R4> v4,
|
||||
ValueValidator<? super A, ? extends R5> v5,
|
||||
ValueValidator<? super A, ? extends R6> v6,
|
||||
ValueValidator<? super A, ? extends R7> v7,
|
||||
ValueValidator<? super A, ? extends R8> v8,
|
||||
ValueValidator<? super A, ? extends R9> v9,
|
||||
ValueValidator<? super A, ? extends R10> v10,
|
||||
ValueValidator<? super A, ? extends R11> v11,
|
||||
ValueValidator<? super A, ? extends R12> v12) {
|
||||
this.v1 = v1;
|
||||
this.v2 = v2;
|
||||
this.v3 = v3;
|
||||
this.v4 = v4;
|
||||
this.v5 = v5;
|
||||
this.v6 = v6;
|
||||
this.v7 = v7;
|
||||
this.v8 = v8;
|
||||
this.v9 = v9;
|
||||
this.v10 = v10;
|
||||
this.v11 = v11;
|
||||
this.v12 = v12;
|
||||
}
|
||||
|
||||
public <X> Arguments1Validator<A, X> apply(
|
||||
Function12<? super R1, ? super R2, ? super R3, ? super R4, ? super R5, ? super R6, ? super R7, ? super R8, ? super R9, ? super R10, ? super R11, ? super R12, ? extends X> f) {
|
||||
return (a, locale, constraintContext) -> Validations.apply(f::apply,
|
||||
this.v1.validate(a, locale, constraintContext),
|
||||
this.v2.validate(a, locale, constraintContext),
|
||||
this.v3.validate(a, locale, constraintContext),
|
||||
this.v4.validate(a, locale, constraintContext),
|
||||
this.v5.validate(a, locale, constraintContext),
|
||||
this.v6.validate(a, locale, constraintContext),
|
||||
this.v7.validate(a, locale, constraintContext),
|
||||
this.v8.validate(a, locale, constraintContext),
|
||||
this.v9.validate(a, locale, constraintContext),
|
||||
this.v10.validate(a, locale, constraintContext),
|
||||
this.v11.validate(a, locale, constraintContext),
|
||||
this.v12.validate(a, locale, constraintContext));
|
||||
}
|
||||
|
||||
public <R13> Arguments13Combining<A, R1, R2, R3, R4, R5, R6, R7, R8, R9, R10, R11, R12, R13> combine(
|
||||
ValueValidator<? super A, ? extends R13> v13) {
|
||||
return new Arguments13Combining<>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11,
|
||||
v12, v13);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,101 @@
|
|||
/*
|
||||
* Copyright (C) 2018-2022 Toshiaki Maki <makingx@gmail.com>
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.xbib.datastructures.validation.arguments;
|
||||
|
||||
import org.xbib.datastructures.validation.core.ValueValidator;
|
||||
import org.xbib.datastructures.validation.fn.Function12;
|
||||
import org.xbib.datastructures.validation.fn.Validations;
|
||||
|
||||
/**
|
||||
* Generated by https://github.com/making/yavi/blob/develop/scripts/generate-args.sh
|
||||
*
|
||||
* @since 0.7.0
|
||||
*/
|
||||
public class Arguments12Splitting<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, R1, R2, R3, R4, R5, R6, R7, R8, R9, R10, R11, R12> {
|
||||
protected final ValueValidator<? super A1, ? extends R1> v1;
|
||||
|
||||
protected final ValueValidator<? super A2, ? extends R2> v2;
|
||||
|
||||
protected final ValueValidator<? super A3, ? extends R3> v3;
|
||||
|
||||
protected final ValueValidator<? super A4, ? extends R4> v4;
|
||||
|
||||
protected final ValueValidator<? super A5, ? extends R5> v5;
|
||||
|
||||
protected final ValueValidator<? super A6, ? extends R6> v6;
|
||||
|
||||
protected final ValueValidator<? super A7, ? extends R7> v7;
|
||||
|
||||
protected final ValueValidator<? super A8, ? extends R8> v8;
|
||||
|
||||
protected final ValueValidator<? super A9, ? extends R9> v9;
|
||||
|
||||
protected final ValueValidator<? super A10, ? extends R10> v10;
|
||||
|
||||
protected final ValueValidator<? super A11, ? extends R11> v11;
|
||||
|
||||
protected final ValueValidator<? super A12, ? extends R12> v12;
|
||||
|
||||
public Arguments12Splitting(ValueValidator<? super A1, ? extends R1> v1,
|
||||
ValueValidator<? super A2, ? extends R2> v2,
|
||||
ValueValidator<? super A3, ? extends R3> v3,
|
||||
ValueValidator<? super A4, ? extends R4> v4,
|
||||
ValueValidator<? super A5, ? extends R5> v5,
|
||||
ValueValidator<? super A6, ? extends R6> v6,
|
||||
ValueValidator<? super A7, ? extends R7> v7,
|
||||
ValueValidator<? super A8, ? extends R8> v8,
|
||||
ValueValidator<? super A9, ? extends R9> v9,
|
||||
ValueValidator<? super A10, ? extends R10> v10,
|
||||
ValueValidator<? super A11, ? extends R11> v11,
|
||||
ValueValidator<? super A12, ? extends R12> v12) {
|
||||
this.v1 = v1;
|
||||
this.v2 = v2;
|
||||
this.v3 = v3;
|
||||
this.v4 = v4;
|
||||
this.v5 = v5;
|
||||
this.v6 = v6;
|
||||
this.v7 = v7;
|
||||
this.v8 = v8;
|
||||
this.v9 = v9;
|
||||
this.v10 = v10;
|
||||
this.v11 = v11;
|
||||
this.v12 = v12;
|
||||
}
|
||||
|
||||
public <X> Arguments12Validator<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, X> apply(
|
||||
Function12<? super R1, ? super R2, ? super R3, ? super R4, ? super R5, ? super R6, ? super R7, ? super R8, ? super R9, ? super R10, ? super R11, ? super R12, ? extends X> f) {
|
||||
return (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, locale,
|
||||
constraintContext) -> Validations.apply(f::apply,
|
||||
this.v1.validate(a1, locale, constraintContext),
|
||||
this.v2.validate(a2, locale, constraintContext),
|
||||
this.v3.validate(a3, locale, constraintContext),
|
||||
this.v4.validate(a4, locale, constraintContext),
|
||||
this.v5.validate(a5, locale, constraintContext),
|
||||
this.v6.validate(a6, locale, constraintContext),
|
||||
this.v7.validate(a7, locale, constraintContext),
|
||||
this.v8.validate(a8, locale, constraintContext),
|
||||
this.v9.validate(a9, locale, constraintContext),
|
||||
this.v10.validate(a10, locale, constraintContext),
|
||||
this.v11.validate(a11, locale, constraintContext),
|
||||
this.v12.validate(a12, locale, constraintContext));
|
||||
}
|
||||
|
||||
public <A13, R13> Arguments13Splitting<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, R1, R2, R3, R4, R5, R6, R7, R8, R9, R10, R11, R12, R13> split(
|
||||
ValueValidator<? super A13, ? extends R13> v13) {
|
||||
return new Arguments13Splitting<>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11,
|
||||
v12, v13);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,150 @@
|
|||
/*
|
||||
* Copyright (C) 2018-2022 Toshiaki Maki <makingx@gmail.com>
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.xbib.datastructures.validation.arguments;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import org.xbib.datastructures.validation.core.ConstraintContext;
|
||||
import org.xbib.datastructures.validation.core.ConstraintGroup;
|
||||
import org.xbib.datastructures.validation.core.ConstraintViolationsException;
|
||||
import org.xbib.datastructures.validation.core.Validated;
|
||||
import org.xbib.datastructures.validation.core.ValueValidator;
|
||||
import org.xbib.datastructures.validation.jsr305.Nullable;
|
||||
|
||||
/**
|
||||
* Generated by https://github.com/making/yavi/blob/develop/scripts/generate-args.sh
|
||||
*
|
||||
* @since 0.3.0
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface Arguments12Validator<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, X> {
|
||||
|
||||
Validated<X> validate(@Nullable A1 a1, @Nullable A2 a2, @Nullable A3 a3,
|
||||
@Nullable A4 a4, @Nullable A5 a5, @Nullable A6 a6, @Nullable A7 a7,
|
||||
@Nullable A8 a8, @Nullable A9 a9, @Nullable A10 a10, @Nullable A11 a11,
|
||||
@Nullable A12 a12, Locale locale, ConstraintContext constraintContext);
|
||||
|
||||
/**
|
||||
* @since 0.7.0
|
||||
*/
|
||||
default <X2> Arguments12Validator<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, X2> andThen(
|
||||
Function<? super X, ? extends X2> mapper) {
|
||||
return (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, locale,
|
||||
constraintContext) -> Arguments12Validator.this.validate(a1, a2, a3, a4,
|
||||
a5, a6, a7, a8, a9, a10, a11, a12, locale, constraintContext)
|
||||
.map(mapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 0.11.0
|
||||
*/
|
||||
default <X2> Arguments12Validator<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, X2> andThen(
|
||||
ValueValidator<? super X, X2> validator) {
|
||||
return (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, locale,
|
||||
constraintContext) -> Arguments12Validator.this
|
||||
.validate(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12,
|
||||
locale, constraintContext)
|
||||
.flatMap(v -> validator.validate(v, locale, constraintContext));
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 0.7.0
|
||||
*/
|
||||
default <A> Arguments1Validator<A, X> compose(
|
||||
Function<? super A, ? extends Arguments12<? extends A1, ? extends A2, ? extends A3, ? extends A4, ? extends A5, ? extends A6, ? extends A7, ? extends A8, ? extends A9, ? extends A10, ? extends A11, ? extends A12>> mapper) {
|
||||
return (a, locale, constraintContext) -> {
|
||||
final Arguments12<? extends A1, ? extends A2, ? extends A3, ? extends A4, ? extends A5, ? extends A6, ? extends A7, ? extends A8, ? extends A9, ? extends A10, ? extends A11, ? extends A12> args = mapper
|
||||
.apply(a);
|
||||
return Arguments12Validator.this.validate(args.arg1(), args.arg2(),
|
||||
args.arg3(), args.arg4(), args.arg5(), args.arg6(), args.arg7(),
|
||||
args.arg8(), args.arg9(), args.arg10(), args.arg11(), args.arg12(),
|
||||
locale, constraintContext);
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 0.10.0
|
||||
*/
|
||||
default Arguments12Validator<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, Supplier<X>> lazy() {
|
||||
// WARNING:: The default implementation is not really lazy!
|
||||
return this.andThen(x -> () -> x);
|
||||
}
|
||||
|
||||
default Validated<X> validate(@Nullable A1 a1, @Nullable A2 a2, @Nullable A3 a3,
|
||||
@Nullable A4 a4, @Nullable A5 a5, @Nullable A6 a6, @Nullable A7 a7,
|
||||
@Nullable A8 a8, @Nullable A9 a9, @Nullable A10 a10, @Nullable A11 a11,
|
||||
@Nullable A12 a12) {
|
||||
return this.validate(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12,
|
||||
Locale.getDefault(), ConstraintGroup.DEFAULT);
|
||||
}
|
||||
|
||||
default Validated<X> validate(@Nullable A1 a1, @Nullable A2 a2, @Nullable A3 a3,
|
||||
@Nullable A4 a4, @Nullable A5 a5, @Nullable A6 a6, @Nullable A7 a7,
|
||||
@Nullable A8 a8, @Nullable A9 a9, @Nullable A10 a10, @Nullable A11 a11,
|
||||
@Nullable A12 a12, ConstraintContext constraintContext) {
|
||||
return this.validate(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12,
|
||||
Locale.getDefault(), constraintContext);
|
||||
}
|
||||
|
||||
default Validated<X> validate(@Nullable A1 a1, @Nullable A2 a2, @Nullable A3 a3,
|
||||
@Nullable A4 a4, @Nullable A5 a5, @Nullable A6 a6, @Nullable A7 a7,
|
||||
@Nullable A8 a8, @Nullable A9 a9, @Nullable A10 a10, @Nullable A11 a11,
|
||||
@Nullable A12 a12, Locale locale) {
|
||||
return this.validate(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, locale,
|
||||
ConstraintGroup.DEFAULT);
|
||||
}
|
||||
|
||||
default X validated(@Nullable A1 a1, @Nullable A2 a2, @Nullable A3 a3,
|
||||
@Nullable A4 a4, @Nullable A5 a5, @Nullable A6 a6, @Nullable A7 a7,
|
||||
@Nullable A8 a8, @Nullable A9 a9, @Nullable A10 a10, @Nullable A11 a11,
|
||||
@Nullable A12 a12) throws ConstraintViolationsException {
|
||||
return this.validate(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12)
|
||||
.orElseThrow(ConstraintViolationsException::new);
|
||||
}
|
||||
|
||||
default X validated(@Nullable A1 a1, @Nullable A2 a2, @Nullable A3 a3,
|
||||
@Nullable A4 a4, @Nullable A5 a5, @Nullable A6 a6, @Nullable A7 a7,
|
||||
@Nullable A8 a8, @Nullable A9 a9, @Nullable A10 a10, @Nullable A11 a11,
|
||||
@Nullable A12 a12, ConstraintContext constraintContext)
|
||||
throws ConstraintViolationsException {
|
||||
return this
|
||||
.validate(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12,
|
||||
constraintContext)
|
||||
.orElseThrow(ConstraintViolationsException::new);
|
||||
}
|
||||
|
||||
default X validated(@Nullable A1 a1, @Nullable A2 a2, @Nullable A3 a3,
|
||||
@Nullable A4 a4, @Nullable A5 a5, @Nullable A6 a6, @Nullable A7 a7,
|
||||
@Nullable A8 a8, @Nullable A9 a9, @Nullable A10 a10, @Nullable A11 a11,
|
||||
@Nullable A12 a12, Locale locale) throws ConstraintViolationsException {
|
||||
return this.validate(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, locale)
|
||||
.orElseThrow(ConstraintViolationsException::new);
|
||||
}
|
||||
|
||||
default X validated(@Nullable A1 a1, @Nullable A2 a2, @Nullable A3 a3,
|
||||
@Nullable A4 a4, @Nullable A5 a5, @Nullable A6 a6, @Nullable A7 a7,
|
||||
@Nullable A8 a8, @Nullable A9 a9, @Nullable A10 a10, @Nullable A11 a11,
|
||||
@Nullable A12 a12, Locale locale, ConstraintContext constraintContext)
|
||||
throws ConstraintViolationsException {
|
||||
return this
|
||||
.validate(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, locale,
|
||||
constraintContext)
|
||||
.orElseThrow(ConstraintViolationsException::new);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,49 @@
|
|||
/*
|
||||
* Copyright (C) 2018-2022 Toshiaki Maki <makingx@gmail.com>
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.xbib.datastructures.validation.arguments;
|
||||
|
||||
import org.xbib.datastructures.validation.fn.Function13;
|
||||
import org.xbib.datastructures.validation.jsr305.Nullable;
|
||||
|
||||
/**
|
||||
* Generated by https://github.com/making/yavi/blob/develop/scripts/generate-args.sh
|
||||
*
|
||||
* @since 0.3.0
|
||||
*/
|
||||
public class Arguments13<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13>
|
||||
extends Arguments12<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12> {
|
||||
|
||||
protected final A13 arg13;
|
||||
|
||||
Arguments13(@Nullable A1 arg1, @Nullable A2 arg2, @Nullable A3 arg3,
|
||||
@Nullable A4 arg4, @Nullable A5 arg5, @Nullable A6 arg6, @Nullable A7 arg7,
|
||||
@Nullable A8 arg8, @Nullable A9 arg9, @Nullable A10 arg10,
|
||||
@Nullable A11 arg11, @Nullable A12 arg12, @Nullable A13 arg13) {
|
||||
super(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12);
|
||||
this.arg13 = arg13;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public final A13 arg13() {
|
||||
return this.arg13;
|
||||
}
|
||||
|
||||
public final <X> X map(
|
||||
Function13<? super A1, ? super A2, ? super A3, ? super A4, ? super A5, ? super A6, ? super A7, ? super A8, ? super A9, ? super A10, ? super A11, ? super A12, ? super A13, ? extends X> mapper) {
|
||||
return mapper.apply(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10,
|
||||
arg11, arg12, arg13);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,105 @@
|
|||
/*
|
||||
* Copyright (C) 2018-2022 Toshiaki Maki <makingx@gmail.com>
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.xbib.datastructures.validation.arguments;
|
||||
|
||||
import org.xbib.datastructures.validation.core.ValueValidator;
|
||||
import org.xbib.datastructures.validation.fn.Function13;
|
||||
import org.xbib.datastructures.validation.fn.Validations;
|
||||
|
||||
/**
|
||||
* Generated by https://github.com/making/yavi/blob/develop/scripts/generate-args.sh
|
||||
*
|
||||
* @since 0.7.0
|
||||
*/
|
||||
public class Arguments13Combining<A, R1, R2, R3, R4, R5, R6, R7, R8, R9, R10, R11, R12, R13> {
|
||||
protected final ValueValidator<? super A, ? extends R1> v1;
|
||||
|
||||
protected final ValueValidator<? super A, ? extends R2> v2;
|
||||
|
||||
protected final ValueValidator<? super A, ? extends R3> v3;
|
||||
|
||||
protected final ValueValidator<? super A, ? extends R4> v4;
|
||||
|
||||
protected final ValueValidator<? super A, ? extends R5> v5;
|
||||
|
||||
protected final ValueValidator<? super A, ? extends R6> v6;
|
||||
|
||||
protected final ValueValidator<? super A, ? extends R7> v7;
|
||||
|
||||
protected final ValueValidator<? super A, ? extends R8> v8;
|
||||
|
||||
protected final ValueValidator<? super A, ? extends R9> v9;
|
||||
|
||||
protected final ValueValidator<? super A, ? extends R10> v10;
|
||||
|
||||
protected final ValueValidator<? super A, ? extends R11> v11;
|
||||
|
||||
protected final ValueValidator<? super A, ? extends R12> v12;
|
||||
|
||||
protected final ValueValidator<? super A, ? extends R13> v13;
|
||||
|
||||
public Arguments13Combining(ValueValidator<? super A, ? extends R1> v1,
|
||||
ValueValidator<? super A, ? extends R2> v2,
|
||||
ValueValidator<? super A, ? extends R3> v3,
|
||||
ValueValidator<? super A, ? extends R4> v4,
|
||||
ValueValidator<? super A, ? extends R5> v5,
|
||||
ValueValidator<? super A, ? extends R6> v6,
|
||||
ValueValidator<? super A, ? extends R7> v7,
|
||||
ValueValidator<? super A, ? extends R8> v8,
|
||||
ValueValidator<? super A, ? extends R9> v9,
|
||||
ValueValidator<? super A, ? extends R10> v10,
|
||||
ValueValidator<? super A, ? extends R11> v11,
|
||||
ValueValidator<? super A, ? extends R12> v12,
|
||||
ValueValidator<? super A, ? extends R13> v13) {
|
||||
this.v1 = v1;
|
||||
this.v2 = v2;
|
||||
this.v3 = v3;
|
||||
this.v4 = v4;
|
||||
this.v5 = v5;
|
||||
this.v6 = v6;
|
||||
this.v7 = v7;
|
||||
this.v8 = v8;
|
||||
this.v9 = v9;
|
||||
this.v10 = v10;
|
||||
this.v11 = v11;
|
||||
this.v12 = v12;
|
||||
this.v13 = v13;
|
||||
}
|
||||
|
||||
public <X> Arguments1Validator<A, X> apply(
|
||||
Function13<? super R1, ? super R2, ? super R3, ? super R4, ? super R5, ? super R6, ? super R7, ? super R8, ? super R9, ? super R10, ? super R11, ? super R12, ? super R13, ? extends X> f) {
|
||||
return (a, locale, constraintContext) -> Validations.apply(f::apply,
|
||||
this.v1.validate(a, locale, constraintContext),
|
||||
this.v2.validate(a, locale, constraintContext),
|
||||
this.v3.validate(a, locale, constraintContext),
|
||||
this.v4.validate(a, locale, constraintContext),
|
||||
this.v5.validate(a, locale, constraintContext),
|
||||
this.v6.validate(a, locale, constraintContext),
|
||||
this.v7.validate(a, locale, constraintContext),
|
||||
this.v8.validate(a, locale, constraintContext),
|
||||
this.v9.validate(a, locale, constraintContext),
|
||||
this.v10.validate(a, locale, constraintContext),
|
||||
this.v11.validate(a, locale, constraintContext),
|
||||
this.v12.validate(a, locale, constraintContext),
|
||||
this.v13.validate(a, locale, constraintContext));
|
||||
}
|
||||
|
||||
public <R14> Arguments14Combining<A, R1, R2, R3, R4, R5, R6, R7, R8, R9, R10, R11, R12, R13, R14> combine(
|
||||
ValueValidator<? super A, ? extends R14> v14) {
|
||||
return new Arguments14Combining<>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11,
|
||||
v12, v13, v14);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,106 @@
|
|||
/*
|
||||
* Copyright (C) 2018-2022 Toshiaki Maki <makingx@gmail.com>
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.xbib.datastructures.validation.arguments;
|
||||
|
||||
import org.xbib.datastructures.validation.core.ValueValidator;
|
||||
import org.xbib.datastructures.validation.fn.Function13;
|
||||
import org.xbib.datastructures.validation.fn.Validations;
|
||||
|
||||
/**
|
||||
* Generated by https://github.com/making/yavi/blob/develop/scripts/generate-args.sh
|
||||
*
|
||||
* @since 0.7.0
|
||||
*/
|
||||
public class Arguments13Splitting<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, R1, R2, R3, R4, R5, R6, R7, R8, R9, R10, R11, R12, R13> {
|
||||
protected final ValueValidator<? super A1, ? extends R1> v1;
|
||||
|
||||
protected final ValueValidator<? super A2, ? extends R2> v2;
|
||||
|
||||
protected final ValueValidator<? super A3, ? extends R3> v3;
|
||||
|
||||
protected final ValueValidator<? super A4, ? extends R4> v4;
|
||||
|
||||
protected final ValueValidator<? super A5, ? extends R5> v5;
|
||||
|
||||
protected final ValueValidator<? super A6, ? extends R6> v6;
|
||||
|
||||
protected final ValueValidator<? super A7, ? extends R7> v7;
|
||||
|
||||
protected final ValueValidator<? super A8, ? extends R8> v8;
|
||||
|
||||
protected final ValueValidator<? super A9, ? extends R9> v9;
|
||||
|
||||
protected final ValueValidator<? super A10, ? extends R10> v10;
|
||||
|
||||
protected final ValueValidator<? super A11, ? extends R11> v11;
|
||||
|
||||
protected final ValueValidator<? super A12, ? extends R12> v12;
|
||||
|
||||
protected final ValueValidator<? super A13, ? extends R13> v13;
|
||||
|
||||
public Arguments13Splitting(ValueValidator<? super A1, ? extends R1> v1,
|
||||
ValueValidator<? super A2, ? extends R2> v2,
|
||||
ValueValidator<? super A3, ? extends R3> v3,
|
||||
ValueValidator<? super A4, ? extends R4> v4,
|
||||
ValueValidator<? super A5, ? extends R5> v5,
|
||||
ValueValidator<? super A6, ? extends R6> v6,
|
||||
ValueValidator<? super A7, ? extends R7> v7,
|
||||
ValueValidator<? super A8, ? extends R8> v8,
|
||||
ValueValidator<? super A9, ? extends R9> v9,
|
||||
ValueValidator<? super A10, ? extends R10> v10,
|
||||
ValueValidator<? super A11, ? extends R11> v11,
|
||||
ValueValidator<? super A12, ? extends R12> v12,
|
||||
ValueValidator<? super A13, ? extends R13> v13) {
|
||||
this.v1 = v1;
|
||||
this.v2 = v2;
|
||||
this.v3 = v3;
|
||||
this.v4 = v4;
|
||||
this.v5 = v5;
|
||||
this.v6 = v6;
|
||||
this.v7 = v7;
|
||||
this.v8 = v8;
|
||||
this.v9 = v9;
|
||||
this.v10 = v10;
|
||||
this.v11 = v11;
|
||||
this.v12 = v12;
|
||||
this.v13 = v13;
|
||||
}
|
||||
|
||||
public <X> Arguments13Validator<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, X> apply(
|
||||
Function13<? super R1, ? super R2, ? super R3, ? super R4, ? super R5, ? super R6, ? super R7, ? super R8, ? super R9, ? super R10, ? super R11, ? super R12, ? super R13, ? extends X> f) {
|
||||
return (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, locale,
|
||||
constraintContext) -> Validations.apply(f::apply,
|
||||
this.v1.validate(a1, locale, constraintContext),
|
||||
this.v2.validate(a2, locale, constraintContext),
|
||||
this.v3.validate(a3, locale, constraintContext),
|
||||
this.v4.validate(a4, locale, constraintContext),
|
||||
this.v5.validate(a5, locale, constraintContext),
|
||||
this.v6.validate(a6, locale, constraintContext),
|
||||
this.v7.validate(a7, locale, constraintContext),
|
||||
this.v8.validate(a8, locale, constraintContext),
|
||||
this.v9.validate(a9, locale, constraintContext),
|
||||
this.v10.validate(a10, locale, constraintContext),
|
||||
this.v11.validate(a11, locale, constraintContext),
|
||||
this.v12.validate(a12, locale, constraintContext),
|
||||
this.v13.validate(a13, locale, constraintContext));
|
||||
}
|
||||
|
||||
public <A14, R14> Arguments14Splitting<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, R1, R2, R3, R4, R5, R6, R7, R8, R9, R10, R11, R12, R13, R14> split(
|
||||
ValueValidator<? super A14, ? extends R14> v14) {
|
||||
return new Arguments14Splitting<>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11,
|
||||
v12, v13, v14);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,153 @@
|
|||
/*
|
||||
* Copyright (C) 2018-2022 Toshiaki Maki <makingx@gmail.com>
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.xbib.datastructures.validation.arguments;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import org.xbib.datastructures.validation.core.ConstraintContext;
|
||||
import org.xbib.datastructures.validation.core.ConstraintGroup;
|
||||
import org.xbib.datastructures.validation.core.ConstraintViolationsException;
|
||||
import org.xbib.datastructures.validation.core.Validated;
|
||||
import org.xbib.datastructures.validation.core.ValueValidator;
|
||||
import org.xbib.datastructures.validation.jsr305.Nullable;
|
||||
|
||||
/**
|
||||
* Generated by https://github.com/making/yavi/blob/develop/scripts/generate-args.sh
|
||||
*
|
||||
* @since 0.3.0
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface Arguments13Validator<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, X> {
|
||||
|
||||
Validated<X> validate(@Nullable A1 a1, @Nullable A2 a2, @Nullable A3 a3,
|
||||
@Nullable A4 a4, @Nullable A5 a5, @Nullable A6 a6, @Nullable A7 a7,
|
||||
@Nullable A8 a8, @Nullable A9 a9, @Nullable A10 a10, @Nullable A11 a11,
|
||||
@Nullable A12 a12, @Nullable A13 a13, Locale locale,
|
||||
ConstraintContext constraintContext);
|
||||
|
||||
/**
|
||||
* @since 0.7.0
|
||||
*/
|
||||
default <X2> Arguments13Validator<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, X2> andThen(
|
||||
Function<? super X, ? extends X2> mapper) {
|
||||
return (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, locale,
|
||||
constraintContext) -> Arguments13Validator.this.validate(a1, a2, a3, a4,
|
||||
a5, a6, a7, a8, a9, a10, a11, a12, a13, locale, constraintContext)
|
||||
.map(mapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 0.11.0
|
||||
*/
|
||||
default <X2> Arguments13Validator<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, X2> andThen(
|
||||
ValueValidator<? super X, X2> validator) {
|
||||
return (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, locale,
|
||||
constraintContext) -> Arguments13Validator.this
|
||||
.validate(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13,
|
||||
locale, constraintContext)
|
||||
.flatMap(v -> validator.validate(v, locale, constraintContext));
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 0.7.0
|
||||
*/
|
||||
default <A> Arguments1Validator<A, X> compose(
|
||||
Function<? super A, ? extends Arguments13<? extends A1, ? extends A2, ? extends A3, ? extends A4, ? extends A5, ? extends A6, ? extends A7, ? extends A8, ? extends A9, ? extends A10, ? extends A11, ? extends A12, ? extends A13>> mapper) {
|
||||
return (a, locale, constraintContext) -> {
|
||||
final Arguments13<? extends A1, ? extends A2, ? extends A3, ? extends A4, ? extends A5, ? extends A6, ? extends A7, ? extends A8, ? extends A9, ? extends A10, ? extends A11, ? extends A12, ? extends A13> args = mapper
|
||||
.apply(a);
|
||||
return Arguments13Validator.this.validate(args.arg1(), args.arg2(),
|
||||
args.arg3(), args.arg4(), args.arg5(), args.arg6(), args.arg7(),
|
||||
args.arg8(), args.arg9(), args.arg10(), args.arg11(), args.arg12(),
|
||||
args.arg13(), locale, constraintContext);
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 0.10.0
|
||||
*/
|
||||
default Arguments13Validator<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, Supplier<X>> lazy() {
|
||||
// WARNING:: The default implementation is not really lazy!
|
||||
return this.andThen(x -> () -> x);
|
||||
}
|
||||
|
||||
default Validated<X> validate(@Nullable A1 a1, @Nullable A2 a2, @Nullable A3 a3,
|
||||
@Nullable A4 a4, @Nullable A5 a5, @Nullable A6 a6, @Nullable A7 a7,
|
||||
@Nullable A8 a8, @Nullable A9 a9, @Nullable A10 a10, @Nullable A11 a11,
|
||||
@Nullable A12 a12, @Nullable A13 a13) {
|
||||
return this.validate(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13,
|
||||
Locale.getDefault(), ConstraintGroup.DEFAULT);
|
||||
}
|
||||
|
||||
default Validated<X> validate(@Nullable A1 a1, @Nullable A2 a2, @Nullable A3 a3,
|
||||
@Nullable A4 a4, @Nullable A5 a5, @Nullable A6 a6, @Nullable A7 a7,
|
||||
@Nullable A8 a8, @Nullable A9 a9, @Nullable A10 a10, @Nullable A11 a11,
|
||||
@Nullable A12 a12, @Nullable A13 a13, ConstraintContext constraintContext) {
|
||||
return this.validate(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13,
|
||||
Locale.getDefault(), constraintContext);
|
||||
}
|
||||
|
||||
default Validated<X> validate(@Nullable A1 a1, @Nullable A2 a2, @Nullable A3 a3,
|
||||
@Nullable A4 a4, @Nullable A5 a5, @Nullable A6 a6, @Nullable A7 a7,
|
||||
@Nullable A8 a8, @Nullable A9 a9, @Nullable A10 a10, @Nullable A11 a11,
|
||||
@Nullable A12 a12, @Nullable A13 a13, Locale locale) {
|
||||
return this.validate(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13,
|
||||
locale, ConstraintGroup.DEFAULT);
|
||||
}
|
||||
|
||||
default X validated(@Nullable A1 a1, @Nullable A2 a2, @Nullable A3 a3,
|
||||
@Nullable A4 a4, @Nullable A5 a5, @Nullable A6 a6, @Nullable A7 a7,
|
||||
@Nullable A8 a8, @Nullable A9 a9, @Nullable A10 a10, @Nullable A11 a11,
|
||||
@Nullable A12 a12, @Nullable A13 a13) throws ConstraintViolationsException {
|
||||
return this.validate(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13)
|
||||
.orElseThrow(ConstraintViolationsException::new);
|
||||
}
|
||||
|
||||
default X validated(@Nullable A1 a1, @Nullable A2 a2, @Nullable A3 a3,
|
||||
@Nullable A4 a4, @Nullable A5 a5, @Nullable A6 a6, @Nullable A7 a7,
|
||||
@Nullable A8 a8, @Nullable A9 a9, @Nullable A10 a10, @Nullable A11 a11,
|
||||
@Nullable A12 a12, @Nullable A13 a13, ConstraintContext constraintContext)
|
||||
throws ConstraintViolationsException {
|
||||
return this
|
||||
.validate(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13,
|
||||
constraintContext)
|
||||
.orElseThrow(ConstraintViolationsException::new);
|
||||
}
|
||||
|
||||
default X validated(@Nullable A1 a1, @Nullable A2 a2, @Nullable A3 a3,
|
||||
@Nullable A4 a4, @Nullable A5 a5, @Nullable A6 a6, @Nullable A7 a7,
|
||||
@Nullable A8 a8, @Nullable A9 a9, @Nullable A10 a10, @Nullable A11 a11,
|
||||
@Nullable A12 a12, @Nullable A13 a13, Locale locale)
|
||||
throws ConstraintViolationsException {
|
||||
return this
|
||||
.validate(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, locale)
|
||||
.orElseThrow(ConstraintViolationsException::new);
|
||||
}
|
||||
|
||||
default X validated(@Nullable A1 a1, @Nullable A2 a2, @Nullable A3 a3,
|
||||
@Nullable A4 a4, @Nullable A5 a5, @Nullable A6 a6, @Nullable A7 a7,
|
||||
@Nullable A8 a8, @Nullable A9 a9, @Nullable A10 a10, @Nullable A11 a11,
|
||||
@Nullable A12 a12, @Nullable A13 a13, Locale locale,
|
||||
ConstraintContext constraintContext) throws ConstraintViolationsException {
|
||||
return this
|
||||
.validate(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, locale,
|
||||
constraintContext)
|
||||
.orElseThrow(ConstraintViolationsException::new);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
/*
|
||||
* Copyright (C) 2018-2022 Toshiaki Maki <makingx@gmail.com>
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.xbib.datastructures.validation.arguments;
|
||||
|
||||
import org.xbib.datastructures.validation.fn.Function14;
|
||||
import org.xbib.datastructures.validation.jsr305.Nullable;
|
||||
|
||||
/**
|
||||
* Generated by https://github.com/making/yavi/blob/develop/scripts/generate-args.sh
|
||||
*
|
||||
* @since 0.3.0
|
||||
*/
|
||||
public class Arguments14<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14>
|
||||
extends Arguments13<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13> {
|
||||
|
||||
protected final A14 arg14;
|
||||
|
||||
Arguments14(@Nullable A1 arg1, @Nullable A2 arg2, @Nullable A3 arg3,
|
||||
@Nullable A4 arg4, @Nullable A5 arg5, @Nullable A6 arg6, @Nullable A7 arg7,
|
||||
@Nullable A8 arg8, @Nullable A9 arg9, @Nullable A10 arg10,
|
||||
@Nullable A11 arg11, @Nullable A12 arg12, @Nullable A13 arg13,
|
||||
@Nullable A14 arg14) {
|
||||
super(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12,
|
||||
arg13);
|
||||
this.arg14 = arg14;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public final A14 arg14() {
|
||||
return this.arg14;
|
||||
}
|
||||
|
||||
public final <X> X map(
|
||||
Function14<? super A1, ? super A2, ? super A3, ? super A4, ? super A5, ? super A6, ? super A7, ? super A8, ? super A9, ? super A10, ? super A11, ? super A12, ? super A13, ? super A14, ? extends X> mapper) {
|
||||
return mapper.apply(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10,
|
||||
arg11, arg12, arg13, arg14);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,110 @@
|
|||
/*
|
||||
* Copyright (C) 2018-2022 Toshiaki Maki <makingx@gmail.com>
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.xbib.datastructures.validation.arguments;
|
||||
|
||||
import org.xbib.datastructures.validation.core.ValueValidator;
|
||||
import org.xbib.datastructures.validation.fn.Function14;
|
||||
import org.xbib.datastructures.validation.fn.Validations;
|
||||
|
||||
/**
|
||||
* Generated by https://github.com/making/yavi/blob/develop/scripts/generate-args.sh
|
||||
*
|
||||
* @since 0.7.0
|
||||
*/
|
||||
public class Arguments14Combining<A, R1, R2, R3, R4, R5, R6, R7, R8, R9, R10, R11, R12, R13, R14> {
|
||||
protected final ValueValidator<? super A, ? extends R1> v1;
|
||||
|
||||
protected final ValueValidator<? super A, ? extends R2> v2;
|
||||
|
||||
protected final ValueValidator<? super A, ? extends R3> v3;
|
||||
|
||||
protected final ValueValidator<? super A, ? extends R4> v4;
|
||||
|
||||
protected final ValueValidator<? super A, ? extends R5> v5;
|
||||
|
||||
protected final ValueValidator<? super A, ? extends R6> v6;
|
||||
|
||||
protected final ValueValidator<? super A, ? extends R7> v7;
|
||||
|
||||
protected final ValueValidator<? super A, ? extends R8> v8;
|
||||
|
||||
protected final ValueValidator<? super A, ? extends R9> v9;
|
||||
|
||||
protected final ValueValidator<? super A, ? extends R10> v10;
|
||||
|
||||
protected final ValueValidator<? super A, ? extends R11> v11;
|
||||
|
||||
protected final ValueValidator<? super A, ? extends R12> v12;
|
||||
|
||||
protected final ValueValidator<? super A, ? extends R13> v13;
|
||||
|
||||
protected final ValueValidator<? super A, ? extends R14> v14;
|
||||
|
||||
public Arguments14Combining(ValueValidator<? super A, ? extends R1> v1,
|
||||
ValueValidator<? super A, ? extends R2> v2,
|
||||
ValueValidator<? super A, ? extends R3> v3,
|
||||
ValueValidator<? super A, ? extends R4> v4,
|
||||
ValueValidator<? super A, ? extends R5> v5,
|
||||
ValueValidator<? super A, ? extends R6> v6,
|
||||
ValueValidator<? super A, ? extends R7> v7,
|
||||
ValueValidator<? super A, ? extends R8> v8,
|
||||
ValueValidator<? super A, ? extends R9> v9,
|
||||
ValueValidator<? super A, ? extends R10> v10,
|
||||
ValueValidator<? super A, ? extends R11> v11,
|
||||
ValueValidator<? super A, ? extends R12> v12,
|
||||
ValueValidator<? super A, ? extends R13> v13,
|
||||
ValueValidator<? super A, ? extends R14> v14) {
|
||||
this.v1 = v1;
|
||||
this.v2 = v2;
|
||||
this.v3 = v3;
|
||||
this.v4 = v4;
|
||||
this.v5 = v5;
|
||||
this.v6 = v6;
|
||||
this.v7 = v7;
|
||||
this.v8 = v8;
|
||||
this.v9 = v9;
|
||||
this.v10 = v10;
|
||||
this.v11 = v11;
|
||||
this.v12 = v12;
|
||||
this.v13 = v13;
|
||||
this.v14 = v14;
|
||||
}
|
||||
|
||||
public <X> Arguments1Validator<A, X> apply(
|
||||
Function14<? super R1, ? super R2, ? super R3, ? super R4, ? super R5, ? super R6, ? super R7, ? super R8, ? super R9, ? super R10, ? super R11, ? super R12, ? super R13, ? super R14, ? extends X> f) {
|
||||
return (a, locale, constraintContext) -> Validations.apply(f::apply,
|
||||
this.v1.validate(a, locale, constraintContext),
|
||||
this.v2.validate(a, locale, constraintContext),
|
||||
this.v3.validate(a, locale, constraintContext),
|
||||
this.v4.validate(a, locale, constraintContext),
|
||||
this.v5.validate(a, locale, constraintContext),
|
||||
this.v6.validate(a, locale, constraintContext),
|
||||
this.v7.validate(a, locale, constraintContext),
|
||||
this.v8.validate(a, locale, constraintContext),
|
||||
this.v9.validate(a, locale, constraintContext),
|
||||
this.v10.validate(a, locale, constraintContext),
|
||||
this.v11.validate(a, locale, constraintContext),
|
||||
this.v12.validate(a, locale, constraintContext),
|
||||
this.v13.validate(a, locale, constraintContext),
|
||||
this.v14.validate(a, locale, constraintContext));
|
||||
}
|
||||
|
||||
public <R15> Arguments15Combining<A, R1, R2, R3, R4, R5, R6, R7, R8, R9, R10, R11, R12, R13, R14, R15> combine(
|
||||
ValueValidator<? super A, ? extends R15> v15) {
|
||||
return new Arguments15Combining<>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11,
|
||||
v12, v13, v14, v15);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,111 @@
|
|||
/*
|
||||
* Copyright (C) 2018-2022 Toshiaki Maki <makingx@gmail.com>
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.xbib.datastructures.validation.arguments;
|
||||
|
||||
import org.xbib.datastructures.validation.core.ValueValidator;
|
||||
import org.xbib.datastructures.validation.fn.Function14;
|
||||
import org.xbib.datastructures.validation.fn.Validations;
|
||||
|
||||
/**
|
||||
* Generated by https://github.com/making/yavi/blob/develop/scripts/generate-args.sh
|
||||
*
|
||||
* @since 0.7.0
|
||||
*/
|
||||
public class Arguments14Splitting<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, R1, R2, R3, R4, R5, R6, R7, R8, R9, R10, R11, R12, R13, R14> {
|
||||
protected final ValueValidator<? super A1, ? extends R1> v1;
|
||||
|
||||
protected final ValueValidator<? super A2, ? extends R2> v2;
|
||||
|
||||
protected final ValueValidator<? super A3, ? extends R3> v3;
|
||||
|
||||
protected final ValueValidator<? super A4, ? extends R4> v4;
|
||||
|
||||
protected final ValueValidator<? super A5, ? extends R5> v5;
|
||||
|
||||
protected final ValueValidator<? super A6, ? extends R6> v6;
|
||||
|
||||
protected final ValueValidator<? super A7, ? extends R7> v7;
|
||||
|
||||
protected final ValueValidator<? super A8, ? extends R8> v8;
|
||||
|
||||
protected final ValueValidator<? super A9, ? extends R9> v9;
|
||||
|
||||
protected final ValueValidator<? super A10, ? extends R10> v10;
|
||||
|
||||
protected final ValueValidator<? super A11, ? extends R11> v11;
|
||||
|
||||
protected final ValueValidator<? super A12, ? extends R12> v12;
|
||||
|
||||
protected final ValueValidator<? super A13, ? extends R13> v13;
|
||||
|
||||
protected final ValueValidator<? super A14, ? extends R14> v14;
|
||||
|
||||
public Arguments14Splitting(ValueValidator<? super A1, ? extends R1> v1,
|
||||
ValueValidator<? super A2, ? extends R2> v2,
|
||||
ValueValidator<? super A3, ? extends R3> v3,
|
||||
ValueValidator<? super A4, ? extends R4> v4,
|
||||
ValueValidator<? super A5, ? extends R5> v5,
|
||||
ValueValidator<? super A6, ? extends R6> v6,
|
||||
ValueValidator<? super A7, ? extends R7> v7,
|
||||
ValueValidator<? super A8, ? extends R8> v8,
|
||||
ValueValidator<? super A9, ? extends R9> v9,
|
||||
ValueValidator<? super A10, ? extends R10> v10,
|
||||
ValueValidator<? super A11, ? extends R11> v11,
|
||||
ValueValidator<? super A12, ? extends R12> v12,
|
||||
ValueValidator<? super A13, ? extends R13> v13,
|
||||
ValueValidator<? super A14, ? extends R14> v14) {
|
||||
this.v1 = v1;
|
||||
this.v2 = v2;
|
||||
this.v3 = v3;
|
||||
this.v4 = v4;
|
||||
this.v5 = v5;
|
||||
this.v6 = v6;
|
||||
this.v7 = v7;
|
||||
this.v8 = v8;
|
||||
this.v9 = v9;
|
||||
this.v10 = v10;
|
||||
this.v11 = v11;
|
||||
this.v12 = v12;
|
||||
this.v13 = v13;
|
||||
this.v14 = v14;
|
||||
}
|
||||
|
||||
public <X> Arguments14Validator<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, X> apply(
|
||||
Function14<? super R1, ? super R2, ? super R3, ? super R4, ? super R5, ? super R6, ? super R7, ? super R8, ? super R9, ? super R10, ? super R11, ? super R12, ? super R13, ? super R14, ? extends X> f) {
|
||||
return (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, locale,
|
||||
constraintContext) -> Validations.apply(f::apply,
|
||||
this.v1.validate(a1, locale, constraintContext),
|
||||
this.v2.validate(a2, locale, constraintContext),
|
||||
this.v3.validate(a3, locale, constraintContext),
|
||||
this.v4.validate(a4, locale, constraintContext),
|
||||
this.v5.validate(a5, locale, constraintContext),
|
||||
this.v6.validate(a6, locale, constraintContext),
|
||||
this.v7.validate(a7, locale, constraintContext),
|
||||
this.v8.validate(a8, locale, constraintContext),
|
||||
this.v9.validate(a9, locale, constraintContext),
|
||||
this.v10.validate(a10, locale, constraintContext),
|
||||
this.v11.validate(a11, locale, constraintContext),
|
||||
this.v12.validate(a12, locale, constraintContext),
|
||||
this.v13.validate(a13, locale, constraintContext),
|
||||
this.v14.validate(a14, locale, constraintContext));
|
||||
}
|
||||
|
||||
public <A15, R15> Arguments15Splitting<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, R1, R2, R3, R4, R5, R6, R7, R8, R9, R10, R11, R12, R13, R14, R15> split(
|
||||
ValueValidator<? super A15, ? extends R15> v15) {
|
||||
return new Arguments15Splitting<>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11,
|
||||
v12, v13, v14, v15);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,155 @@
|
|||
/*
|
||||
* Copyright (C) 2018-2022 Toshiaki Maki <makingx@gmail.com>
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.xbib.datastructures.validation.arguments;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import org.xbib.datastructures.validation.core.ConstraintContext;
|
||||
import org.xbib.datastructures.validation.core.ConstraintGroup;
|
||||
import org.xbib.datastructures.validation.core.ConstraintViolationsException;
|
||||
import org.xbib.datastructures.validation.core.Validated;
|
||||
import org.xbib.datastructures.validation.core.ValueValidator;
|
||||
import org.xbib.datastructures.validation.jsr305.Nullable;
|
||||
|
||||
/**
|
||||
* Generated by https://github.com/making/yavi/blob/develop/scripts/generate-args.sh
|
||||
*
|
||||
* @since 0.3.0
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface Arguments14Validator<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, X> {
|
||||
|
||||
Validated<X> validate(@Nullable A1 a1, @Nullable A2 a2, @Nullable A3 a3,
|
||||
@Nullable A4 a4, @Nullable A5 a5, @Nullable A6 a6, @Nullable A7 a7,
|
||||
@Nullable A8 a8, @Nullable A9 a9, @Nullable A10 a10, @Nullable A11 a11,
|
||||
@Nullable A12 a12, @Nullable A13 a13, @Nullable A14 a14, Locale locale,
|
||||
ConstraintContext constraintContext);
|
||||
|
||||
/**
|
||||
* @since 0.7.0
|
||||
*/
|
||||
default <X2> Arguments14Validator<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, X2> andThen(
|
||||
Function<? super X, ? extends X2> mapper) {
|
||||
return (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, locale,
|
||||
constraintContext) -> Arguments14Validator.this
|
||||
.validate(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13,
|
||||
a14, locale, constraintContext)
|
||||
.map(mapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 0.11.0
|
||||
*/
|
||||
default <X2> Arguments14Validator<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, X2> andThen(
|
||||
ValueValidator<? super X, X2> validator) {
|
||||
return (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, locale,
|
||||
constraintContext) -> Arguments14Validator.this
|
||||
.validate(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13,
|
||||
a14, locale, constraintContext)
|
||||
.flatMap(v -> validator.validate(v, locale, constraintContext));
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 0.7.0
|
||||
*/
|
||||
default <A> Arguments1Validator<A, X> compose(
|
||||
Function<? super A, ? extends Arguments14<? extends A1, ? extends A2, ? extends A3, ? extends A4, ? extends A5, ? extends A6, ? extends A7, ? extends A8, ? extends A9, ? extends A10, ? extends A11, ? extends A12, ? extends A13, ? extends A14>> mapper) {
|
||||
return (a, locale, constraintContext) -> {
|
||||
final Arguments14<? extends A1, ? extends A2, ? extends A3, ? extends A4, ? extends A5, ? extends A6, ? extends A7, ? extends A8, ? extends A9, ? extends A10, ? extends A11, ? extends A12, ? extends A13, ? extends A14> args = mapper
|
||||
.apply(a);
|
||||
return Arguments14Validator.this.validate(args.arg1(), args.arg2(),
|
||||
args.arg3(), args.arg4(), args.arg5(), args.arg6(), args.arg7(),
|
||||
args.arg8(), args.arg9(), args.arg10(), args.arg11(), args.arg12(),
|
||||
args.arg13(), args.arg14(), locale, constraintContext);
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 0.10.0
|
||||
*/
|
||||
default Arguments14Validator<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, Supplier<X>> lazy() {
|
||||
// WARNING:: The default implementation is not really lazy!
|
||||
return this.andThen(x -> () -> x);
|
||||
}
|
||||
|
||||
default Validated<X> validate(@Nullable A1 a1, @Nullable A2 a2, @Nullable A3 a3,
|
||||
@Nullable A4 a4, @Nullable A5 a5, @Nullable A6 a6, @Nullable A7 a7,
|
||||
@Nullable A8 a8, @Nullable A9 a9, @Nullable A10 a10, @Nullable A11 a11,
|
||||
@Nullable A12 a12, @Nullable A13 a13, @Nullable A14 a14) {
|
||||
return this.validate(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14,
|
||||
Locale.getDefault(), ConstraintGroup.DEFAULT);
|
||||
}
|
||||
|
||||
default Validated<X> validate(@Nullable A1 a1, @Nullable A2 a2, @Nullable A3 a3,
|
||||
@Nullable A4 a4, @Nullable A5 a5, @Nullable A6 a6, @Nullable A7 a7,
|
||||
@Nullable A8 a8, @Nullable A9 a9, @Nullable A10 a10, @Nullable A11 a11,
|
||||
@Nullable A12 a12, @Nullable A13 a13, @Nullable A14 a14,
|
||||
ConstraintContext constraintContext) {
|
||||
return this.validate(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14,
|
||||
Locale.getDefault(), constraintContext);
|
||||
}
|
||||
|
||||
default Validated<X> validate(@Nullable A1 a1, @Nullable A2 a2, @Nullable A3 a3,
|
||||
@Nullable A4 a4, @Nullable A5 a5, @Nullable A6 a6, @Nullable A7 a7,
|
||||
@Nullable A8 a8, @Nullable A9 a9, @Nullable A10 a10, @Nullable A11 a11,
|
||||
@Nullable A12 a12, @Nullable A13 a13, @Nullable A14 a14, Locale locale) {
|
||||
return this.validate(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14,
|
||||
locale, ConstraintGroup.DEFAULT);
|
||||
}
|
||||
|
||||
default X validated(@Nullable A1 a1, @Nullable A2 a2, @Nullable A3 a3,
|
||||
@Nullable A4 a4, @Nullable A5 a5, @Nullable A6 a6, @Nullable A7 a7,
|
||||
@Nullable A8 a8, @Nullable A9 a9, @Nullable A10 a10, @Nullable A11 a11,
|
||||
@Nullable A12 a12, @Nullable A13 a13, @Nullable A14 a14)
|
||||
throws ConstraintViolationsException {
|
||||
return this.validate(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14)
|
||||
.orElseThrow(ConstraintViolationsException::new);
|
||||
}
|
||||
|
||||
default X validated(@Nullable A1 a1, @Nullable A2 a2, @Nullable A3 a3,
|
||||
@Nullable A4 a4, @Nullable A5 a5, @Nullable A6 a6, @Nullable A7 a7,
|
||||
@Nullable A8 a8, @Nullable A9 a9, @Nullable A10 a10, @Nullable A11 a11,
|
||||
@Nullable A12 a12, @Nullable A13 a13, @Nullable A14 a14,
|
||||
ConstraintContext constraintContext) throws ConstraintViolationsException {
|
||||
return this
|
||||
.validate(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14,
|
||||
constraintContext)
|
||||
.orElseThrow(ConstraintViolationsException::new);
|
||||
}
|
||||
|
||||
default X validated(@Nullable A1 a1, @Nullable A2 a2, @Nullable A3 a3,
|
||||
@Nullable A4 a4, @Nullable A5 a5, @Nullable A6 a6, @Nullable A7 a7,
|
||||
@Nullable A8 a8, @Nullable A9 a9, @Nullable A10 a10, @Nullable A11 a11,
|
||||
@Nullable A12 a12, @Nullable A13 a13, @Nullable A14 a14, Locale locale)
|
||||
throws ConstraintViolationsException {
|
||||
return this.validate(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14,
|
||||
locale).orElseThrow(ConstraintViolationsException::new);
|
||||
}
|
||||
|
||||
default X validated(@Nullable A1 a1, @Nullable A2 a2, @Nullable A3 a3,
|
||||
@Nullable A4 a4, @Nullable A5 a5, @Nullable A6 a6, @Nullable A7 a7,
|
||||
@Nullable A8 a8, @Nullable A9 a9, @Nullable A10 a10, @Nullable A11 a11,
|
||||
@Nullable A12 a12, @Nullable A13 a13, @Nullable A14 a14, Locale locale,
|
||||
ConstraintContext constraintContext) throws ConstraintViolationsException {
|
||||
return this
|
||||
.validate(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14,
|
||||
locale, constraintContext)
|
||||
.orElseThrow(ConstraintViolationsException::new);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
/*
|
||||
* Copyright (C) 2018-2022 Toshiaki Maki <makingx@gmail.com>
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.xbib.datastructures.validation.arguments;
|
||||
|
||||
import org.xbib.datastructures.validation.fn.Function15;
|
||||
import org.xbib.datastructures.validation.jsr305.Nullable;
|
||||
|
||||
/**
|
||||
* Generated by https://github.com/making/yavi/blob/develop/scripts/generate-args.sh
|
||||
*
|
||||
* @since 0.3.0
|
||||
*/
|
||||
public class Arguments15<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15>
|
||||
extends Arguments14<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14> {
|
||||
|
||||
protected final A15 arg15;
|
||||
|
||||
Arguments15(@Nullable A1 arg1, @Nullable A2 arg2, @Nullable A3 arg3,
|
||||
@Nullable A4 arg4, @Nullable A5 arg5, @Nullable A6 arg6, @Nullable A7 arg7,
|
||||
@Nullable A8 arg8, @Nullable A9 arg9, @Nullable A10 arg10,
|
||||
@Nullable A11 arg11, @Nullable A12 arg12, @Nullable A13 arg13,
|
||||
@Nullable A14 arg14, @Nullable A15 arg15) {
|
||||
super(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12,
|
||||
arg13, arg14);
|
||||
this.arg15 = arg15;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public final A15 arg15() {
|
||||
return this.arg15;
|
||||
}
|
||||
|
||||
public final <X> X map(
|
||||
Function15<? super A1, ? super A2, ? super A3, ? super A4, ? super A5, ? super A6, ? super A7, ? super A8, ? super A9, ? super A10, ? super A11, ? super A12, ? super A13, ? super A14, ? super A15, ? extends X> mapper) {
|
||||
return mapper.apply(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10,
|
||||
arg11, arg12, arg13, arg14, arg15);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,115 @@
|
|||
/*
|
||||
* Copyright (C) 2018-2022 Toshiaki Maki <makingx@gmail.com>
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.xbib.datastructures.validation.arguments;
|
||||
|
||||
import org.xbib.datastructures.validation.core.ValueValidator;
|
||||
import org.xbib.datastructures.validation.fn.Function15;
|
||||
import org.xbib.datastructures.validation.fn.Validations;
|
||||
|
||||
/**
|
||||
* Generated by https://github.com/making/yavi/blob/develop/scripts/generate-args.sh
|
||||
*
|
||||
* @since 0.7.0
|
||||
*/
|
||||
public class Arguments15Combining<A, R1, R2, R3, R4, R5, R6, R7, R8, R9, R10, R11, R12, R13, R14, R15> {
|
||||
protected final ValueValidator<? super A, ? extends R1> v1;
|
||||
|
||||
protected final ValueValidator<? super A, ? extends R2> v2;
|
||||
|
||||
protected final ValueValidator<? super A, ? extends R3> v3;
|
||||
|
||||
protected final ValueValidator<? super A, ? extends R4> v4;
|
||||
|
||||
protected final ValueValidator<? super A, ? extends R5> v5;
|
||||
|
||||
protected final ValueValidator<? super A, ? extends R6> v6;
|
||||
|
||||
protected final ValueValidator<? super A, ? extends R7> v7;
|
||||
|
||||
protected final ValueValidator<? super A, ? extends R8> v8;
|
||||
|
||||
protected final ValueValidator<? super A, ? extends R9> v9;
|
||||
|
||||
protected final ValueValidator<? super A, ? extends R10> v10;
|
||||
|
||||
protected final ValueValidator<? super A, ? extends R11> v11;
|
||||
|
||||
protected final ValueValidator<? super A, ? extends R12> v12;
|
||||
|
||||
protected final ValueValidator<? super A, ? extends R13> v13;
|
||||
|
||||
protected final ValueValidator<? super A, ? extends R14> v14;
|
||||
|
||||
protected final ValueValidator<? super A, ? extends R15> v15;
|
||||
|
||||
public Arguments15Combining(ValueValidator<? super A, ? extends R1> v1,
|
||||
ValueValidator<? super A, ? extends R2> v2,
|
||||
ValueValidator<? super A, ? extends R3> v3,
|
||||
ValueValidator<? super A, ? extends R4> v4,
|
||||
ValueValidator<? super A, ? extends R5> v5,
|
||||
ValueValidator<? super A, ? extends R6> v6,
|
||||
ValueValidator<? super A, ? extends R7> v7,
|
||||
ValueValidator<? super A, ? extends R8> v8,
|
||||
ValueValidator<? super A, ? extends R9> v9,
|
||||
ValueValidator<? super A, ? extends R10> v10,
|
||||
ValueValidator<? super A, ? extends R11> v11,
|
||||
ValueValidator<? super A, ? extends R12> v12,
|
||||
ValueValidator<? super A, ? extends R13> v13,
|
||||
ValueValidator<? super A, ? extends R14> v14,
|
||||
ValueValidator<? super A, ? extends R15> v15) {
|
||||
this.v1 = v1;
|
||||
this.v2 = v2;
|
||||
this.v3 = v3;
|
||||
this.v4 = v4;
|
||||
this.v5 = v5;
|
||||
this.v6 = v6;
|
||||
this.v7 = v7;
|
||||
this.v8 = v8;
|
||||
this.v9 = v9;
|
||||
this.v10 = v10;
|
||||
this.v11 = v11;
|
||||
this.v12 = v12;
|
||||
this.v13 = v13;
|
||||
this.v14 = v14;
|
||||
this.v15 = v15;
|
||||
}
|
||||
|
||||
public <X> Arguments1Validator<A, X> apply(
|
||||
Function15<? super R1, ? super R2, ? super R3, ? super R4, ? super R5, ? super R6, ? super R7, ? super R8, ? super R9, ? super R10, ? super R11, ? super R12, ? super R13, ? super R14, ? super R15, ? extends X> f) {
|
||||
return (a, locale, constraintContext) -> Validations.apply(f::apply,
|
||||
this.v1.validate(a, locale, constraintContext),
|
||||
this.v2.validate(a, locale, constraintContext),
|
||||
this.v3.validate(a, locale, constraintContext),
|
||||
this.v4.validate(a, locale, constraintContext),
|
||||
this.v5.validate(a, locale, constraintContext),
|
||||
this.v6.validate(a, locale, constraintContext),
|
||||
this.v7.validate(a, locale, constraintContext),
|
||||
this.v8.validate(a, locale, constraintContext),
|
||||
this.v9.validate(a, locale, constraintContext),
|
||||
this.v10.validate(a, locale, constraintContext),
|
||||
this.v11.validate(a, locale, constraintContext),
|
||||
this.v12.validate(a, locale, constraintContext),
|
||||
this.v13.validate(a, locale, constraintContext),
|
||||
this.v14.validate(a, locale, constraintContext),
|
||||
this.v15.validate(a, locale, constraintContext));
|
||||
}
|
||||
|
||||
public <R16> Arguments16Combining<A, R1, R2, R3, R4, R5, R6, R7, R8, R9, R10, R11, R12, R13, R14, R15, R16> combine(
|
||||
ValueValidator<? super A, ? extends R16> v16) {
|
||||
return new Arguments16Combining<>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11,
|
||||
v12, v13, v14, v15, v16);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,116 @@
|
|||
/*
|
||||
* Copyright (C) 2018-2022 Toshiaki Maki <makingx@gmail.com>
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.xbib.datastructures.validation.arguments;
|
||||
|
||||
import org.xbib.datastructures.validation.core.ValueValidator;
|
||||
import org.xbib.datastructures.validation.fn.Function15;
|
||||
import org.xbib.datastructures.validation.fn.Validations;
|
||||
|
||||
/**
|
||||
* Generated by https://github.com/making/yavi/blob/develop/scripts/generate-args.sh
|
||||
*
|
||||
* @since 0.7.0
|
||||
*/
|
||||
public class Arguments15Splitting<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, R1, R2, R3, R4, R5, R6, R7, R8, R9, R10, R11, R12, R13, R14, R15> {
|
||||
protected final ValueValidator<? super A1, ? extends R1> v1;
|
||||
|
||||
protected final ValueValidator<? super A2, ? extends R2> v2;
|
||||
|
||||
protected final ValueValidator<? super A3, ? extends R3> v3;
|
||||
|
||||
protected final ValueValidator<? super A4, ? extends R4> v4;
|
||||
|
||||
protected final ValueValidator<? super A5, ? extends R5> v5;
|
||||
|
||||
protected final ValueValidator<? super A6, ? extends R6> v6;
|
||||
|
||||
protected final ValueValidator<? super A7, ? extends R7> v7;
|
||||
|
||||
protected final ValueValidator<? super A8, ? extends R8> v8;
|
||||
|
||||
protected final ValueValidator<? super A9, ? extends R9> v9;
|
||||
|
||||
protected final ValueValidator<? super A10, ? extends R10> v10;
|
||||
|
||||
protected final ValueValidator<? super A11, ? extends R11> v11;
|
||||
|
||||
protected final ValueValidator<? super A12, ? extends R12> v12;
|
||||
|
||||
protected final ValueValidator<? super A13, ? extends R13> v13;
|
||||
|
||||
protected final ValueValidator<? super A14, ? extends R14> v14;
|
||||
|
||||
protected final ValueValidator<? super A15, ? extends R15> v15;
|
||||
|
||||
public Arguments15Splitting(ValueValidator<? super A1, ? extends R1> v1,
|
||||
ValueValidator<? super A2, ? extends R2> v2,
|
||||
ValueValidator<? super A3, ? extends R3> v3,
|
||||
ValueValidator<? super A4, ? extends R4> v4,
|
||||
ValueValidator<? super A5, ? extends R5> v5,
|
||||
ValueValidator<? super A6, ? extends R6> v6,
|
||||
ValueValidator<? super A7, ? extends R7> v7,
|
||||
ValueValidator<? super A8, ? extends R8> v8,
|
||||
ValueValidator<? super A9, ? extends R9> v9,
|
||||
ValueValidator<? super A10, ? extends R10> v10,
|
||||
ValueValidator<? super A11, ? extends R11> v11,
|
||||
ValueValidator<? super A12, ? extends R12> v12,
|
||||
ValueValidator<? super A13, ? extends R13> v13,
|
||||
ValueValidator<? super A14, ? extends R14> v14,
|
||||
ValueValidator<? super A15, ? extends R15> v15) {
|
||||
this.v1 = v1;
|
||||
this.v2 = v2;
|
||||
this.v3 = v3;
|
||||
this.v4 = v4;
|
||||
this.v5 = v5;
|
||||
this.v6 = v6;
|
||||
this.v7 = v7;
|
||||
this.v8 = v8;
|
||||
this.v9 = v9;
|
||||
this.v10 = v10;
|
||||
this.v11 = v11;
|
||||
this.v12 = v12;
|
||||
this.v13 = v13;
|
||||
this.v14 = v14;
|
||||
this.v15 = v15;
|
||||
}
|
||||
|
||||
public <X> Arguments15Validator<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, X> apply(
|
||||
Function15<? super R1, ? super R2, ? super R3, ? super R4, ? super R5, ? super R6, ? super R7, ? super R8, ? super R9, ? super R10, ? super R11, ? super R12, ? super R13, ? super R14, ? super R15, ? extends X> f) {
|
||||
return (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, locale,
|
||||
constraintContext) -> Validations.apply(f::apply,
|
||||
this.v1.validate(a1, locale, constraintContext),
|
||||
this.v2.validate(a2, locale, constraintContext),
|
||||
this.v3.validate(a3, locale, constraintContext),
|
||||
this.v4.validate(a4, locale, constraintContext),
|
||||
this.v5.validate(a5, locale, constraintContext),
|
||||
this.v6.validate(a6, locale, constraintContext),
|
||||
this.v7.validate(a7, locale, constraintContext),
|
||||
this.v8.validate(a8, locale, constraintContext),
|
||||
this.v9.validate(a9, locale, constraintContext),
|
||||
this.v10.validate(a10, locale, constraintContext),
|
||||
this.v11.validate(a11, locale, constraintContext),
|
||||
this.v12.validate(a12, locale, constraintContext),
|
||||
this.v13.validate(a13, locale, constraintContext),
|
||||
this.v14.validate(a14, locale, constraintContext),
|
||||
this.v15.validate(a15, locale, constraintContext));
|
||||
}
|
||||
|
||||
public <A16, R16> Arguments16Splitting<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, R1, R2, R3, R4, R5, R6, R7, R8, R9, R10, R11, R12, R13, R14, R15, R16> split(
|
||||
ValueValidator<? super A16, ? extends R16> v16) {
|
||||
return new Arguments16Splitting<>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11,
|
||||
v12, v13, v14, v15, v16);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,157 @@
|
|||
/*
|
||||
* Copyright (C) 2018-2022 Toshiaki Maki <makingx@gmail.com>
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.xbib.datastructures.validation.arguments;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import org.xbib.datastructures.validation.core.ConstraintContext;
|
||||
import org.xbib.datastructures.validation.core.ConstraintGroup;
|
||||
import org.xbib.datastructures.validation.core.ConstraintViolationsException;
|
||||
import org.xbib.datastructures.validation.core.Validated;
|
||||
import org.xbib.datastructures.validation.core.ValueValidator;
|
||||
import org.xbib.datastructures.validation.jsr305.Nullable;
|
||||
|
||||
/**
|
||||
* Generated by https://github.com/making/yavi/blob/develop/scripts/generate-args.sh
|
||||
*
|
||||
* @since 0.3.0
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface Arguments15Validator<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, X> {
|
||||
|
||||
Validated<X> validate(@Nullable A1 a1, @Nullable A2 a2, @Nullable A3 a3,
|
||||
@Nullable A4 a4, @Nullable A5 a5, @Nullable A6 a6, @Nullable A7 a7,
|
||||
@Nullable A8 a8, @Nullable A9 a9, @Nullable A10 a10, @Nullable A11 a11,
|
||||
@Nullable A12 a12, @Nullable A13 a13, @Nullable A14 a14, @Nullable A15 a15,
|
||||
Locale locale, ConstraintContext constraintContext);
|
||||
|
||||
/**
|
||||
* @since 0.7.0
|
||||
*/
|
||||
default <X2> Arguments15Validator<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, X2> andThen(
|
||||
Function<? super X, ? extends X2> mapper) {
|
||||
return (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, locale,
|
||||
constraintContext) -> Arguments15Validator.this
|
||||
.validate(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13,
|
||||
a14, a15, locale, constraintContext)
|
||||
.map(mapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 0.11.0
|
||||
*/
|
||||
default <X2> Arguments15Validator<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, X2> andThen(
|
||||
ValueValidator<? super X, X2> validator) {
|
||||
return (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, locale,
|
||||
constraintContext) -> Arguments15Validator.this
|
||||
.validate(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13,
|
||||
a14, a15, locale, constraintContext)
|
||||
.flatMap(v -> validator.validate(v, locale, constraintContext));
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 0.7.0
|
||||
*/
|
||||
default <A> Arguments1Validator<A, X> compose(
|
||||
Function<? super A, ? extends Arguments15<? extends A1, ? extends A2, ? extends A3, ? extends A4, ? extends A5, ? extends A6, ? extends A7, ? extends A8, ? extends A9, ? extends A10, ? extends A11, ? extends A12, ? extends A13, ? extends A14, ? extends A15>> mapper) {
|
||||
return (a, locale, constraintContext) -> {
|
||||
final Arguments15<? extends A1, ? extends A2, ? extends A3, ? extends A4, ? extends A5, ? extends A6, ? extends A7, ? extends A8, ? extends A9, ? extends A10, ? extends A11, ? extends A12, ? extends A13, ? extends A14, ? extends A15> args = mapper
|
||||
.apply(a);
|
||||
return Arguments15Validator.this.validate(args.arg1(), args.arg2(),
|
||||
args.arg3(), args.arg4(), args.arg5(), args.arg6(), args.arg7(),
|
||||
args.arg8(), args.arg9(), args.arg10(), args.arg11(), args.arg12(),
|
||||
args.arg13(), args.arg14(), args.arg15(), locale, constraintContext);
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 0.10.0
|
||||
*/
|
||||
default Arguments15Validator<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, Supplier<X>> lazy() {
|
||||
// WARNING:: The default implementation is not really lazy!
|
||||
return this.andThen(x -> () -> x);
|
||||
}
|
||||
|
||||
default Validated<X> validate(@Nullable A1 a1, @Nullable A2 a2, @Nullable A3 a3,
|
||||
@Nullable A4 a4, @Nullable A5 a5, @Nullable A6 a6, @Nullable A7 a7,
|
||||
@Nullable A8 a8, @Nullable A9 a9, @Nullable A10 a10, @Nullable A11 a11,
|
||||
@Nullable A12 a12, @Nullable A13 a13, @Nullable A14 a14, @Nullable A15 a15) {
|
||||
return this.validate(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14,
|
||||
a15, Locale.getDefault(), ConstraintGroup.DEFAULT);
|
||||
}
|
||||
|
||||
default Validated<X> validate(@Nullable A1 a1, @Nullable A2 a2, @Nullable A3 a3,
|
||||
@Nullable A4 a4, @Nullable A5 a5, @Nullable A6 a6, @Nullable A7 a7,
|
||||
@Nullable A8 a8, @Nullable A9 a9, @Nullable A10 a10, @Nullable A11 a11,
|
||||
@Nullable A12 a12, @Nullable A13 a13, @Nullable A14 a14, @Nullable A15 a15,
|
||||
ConstraintContext constraintContext) {
|
||||
return this.validate(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14,
|
||||
a15, Locale.getDefault(), constraintContext);
|
||||
}
|
||||
|
||||
default Validated<X> validate(@Nullable A1 a1, @Nullable A2 a2, @Nullable A3 a3,
|
||||
@Nullable A4 a4, @Nullable A5 a5, @Nullable A6 a6, @Nullable A7 a7,
|
||||
@Nullable A8 a8, @Nullable A9 a9, @Nullable A10 a10, @Nullable A11 a11,
|
||||
@Nullable A12 a12, @Nullable A13 a13, @Nullable A14 a14, @Nullable A15 a15,
|
||||
Locale locale) {
|
||||
return this.validate(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14,
|
||||
a15, locale, ConstraintGroup.DEFAULT);
|
||||
}
|
||||
|
||||
default X validated(@Nullable A1 a1, @Nullable A2 a2, @Nullable A3 a3,
|
||||
@Nullable A4 a4, @Nullable A5 a5, @Nullable A6 a6, @Nullable A7 a7,
|
||||
@Nullable A8 a8, @Nullable A9 a9, @Nullable A10 a10, @Nullable A11 a11,
|
||||
@Nullable A12 a12, @Nullable A13 a13, @Nullable A14 a14, @Nullable A15 a15)
|
||||
throws ConstraintViolationsException {
|
||||
return this.validate(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14,
|
||||
a15).orElseThrow(ConstraintViolationsException::new);
|
||||
}
|
||||
|
||||
default X validated(@Nullable A1 a1, @Nullable A2 a2, @Nullable A3 a3,
|
||||
@Nullable A4 a4, @Nullable A5 a5, @Nullable A6 a6, @Nullable A7 a7,
|
||||
@Nullable A8 a8, @Nullable A9 a9, @Nullable A10 a10, @Nullable A11 a11,
|
||||
@Nullable A12 a12, @Nullable A13 a13, @Nullable A14 a14, @Nullable A15 a15,
|
||||
ConstraintContext constraintContext) throws ConstraintViolationsException {
|
||||
return this
|
||||
.validate(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14,
|
||||
a15, constraintContext)
|
||||
.orElseThrow(ConstraintViolationsException::new);
|
||||
}
|
||||
|
||||
default X validated(@Nullable A1 a1, @Nullable A2 a2, @Nullable A3 a3,
|
||||
@Nullable A4 a4, @Nullable A5 a5, @Nullable A6 a6, @Nullable A7 a7,
|
||||
@Nullable A8 a8, @Nullable A9 a9, @Nullable A10 a10, @Nullable A11 a11,
|
||||
@Nullable A12 a12, @Nullable A13 a13, @Nullable A14 a14, @Nullable A15 a15,
|
||||
Locale locale) throws ConstraintViolationsException {
|
||||
return this.validate(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14,
|
||||
a15, locale).orElseThrow(ConstraintViolationsException::new);
|
||||
}
|
||||
|
||||
default X validated(@Nullable A1 a1, @Nullable A2 a2, @Nullable A3 a3,
|
||||
@Nullable A4 a4, @Nullable A5 a5, @Nullable A6 a6, @Nullable A7 a7,
|
||||
@Nullable A8 a8, @Nullable A9 a9, @Nullable A10 a10, @Nullable A11 a11,
|
||||
@Nullable A12 a12, @Nullable A13 a13, @Nullable A14 a14, @Nullable A15 a15,
|
||||
Locale locale, ConstraintContext constraintContext)
|
||||
throws ConstraintViolationsException {
|
||||
return this
|
||||
.validate(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14,
|
||||
a15, locale, constraintContext)
|
||||
.orElseThrow(ConstraintViolationsException::new);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,52 @@
|
|||
/*
|
||||
* Copyright (C) 2018-2022 Toshiaki Maki <makingx@gmail.com>
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.xbib.datastructures.validation.arguments;
|
||||
|
||||
import org.xbib.datastructures.validation.fn.Function16;
|
||||
import org.xbib.datastructures.validation.jsr305.Nullable;
|
||||
|
||||
/**
|
||||
* Generated by https://github.com/making/yavi/blob/develop/scripts/generate-args.sh
|
||||
*
|
||||
* @since 0.3.0
|
||||
*/
|
||||
public class Arguments16<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16>
|
||||
extends
|
||||
Arguments15<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15> {
|
||||
|
||||
protected final A16 arg16;
|
||||
|
||||
Arguments16(@Nullable A1 arg1, @Nullable A2 arg2, @Nullable A3 arg3,
|
||||
@Nullable A4 arg4, @Nullable A5 arg5, @Nullable A6 arg6, @Nullable A7 arg7,
|
||||
@Nullable A8 arg8, @Nullable A9 arg9, @Nullable A10 arg10,
|
||||
@Nullable A11 arg11, @Nullable A12 arg12, @Nullable A13 arg13,
|
||||
@Nullable A14 arg14, @Nullable A15 arg15, @Nullable A16 arg16) {
|
||||
super(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12,
|
||||
arg13, arg14, arg15);
|
||||
this.arg16 = arg16;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public final A16 arg16() {
|
||||
return this.arg16;
|
||||
}
|
||||
|
||||
public final <X> X map(
|
||||
Function16<? super A1, ? super A2, ? super A3, ? super A4, ? super A5, ? super A6, ? super A7, ? super A8, ? super A9, ? super A10, ? super A11, ? super A12, ? super A13, ? super A14, ? super A15, ? super A16, ? extends X> mapper) {
|
||||
return mapper.apply(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10,
|
||||
arg11, arg12, arg13, arg14, arg15, arg16);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,115 @@
|
|||
/*
|
||||
* Copyright (C) 2018-2022 Toshiaki Maki <makingx@gmail.com>
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.xbib.datastructures.validation.arguments;
|
||||
|
||||
import org.xbib.datastructures.validation.core.ValueValidator;
|
||||
import org.xbib.datastructures.validation.fn.Function16;
|
||||
import org.xbib.datastructures.validation.fn.Validations;
|
||||
|
||||
/**
|
||||
* Generated by https://github.com/making/yavi/blob/develop/scripts/generate-args.sh
|
||||
*
|
||||
* @since 0.7.0
|
||||
*/
|
||||
public class Arguments16Combining<A, R1, R2, R3, R4, R5, R6, R7, R8, R9, R10, R11, R12, R13, R14, R15, R16> {
|
||||
protected final ValueValidator<? super A, ? extends R1> v1;
|
||||
|
||||
protected final ValueValidator<? super A, ? extends R2> v2;
|
||||
|
||||
protected final ValueValidator<? super A, ? extends R3> v3;
|
||||
|
||||
protected final ValueValidator<? super A, ? extends R4> v4;
|
||||
|
||||
protected final ValueValidator<? super A, ? extends R5> v5;
|
||||
|
||||
protected final ValueValidator<? super A, ? extends R6> v6;
|
||||
|
||||
protected final ValueValidator<? super A, ? extends R7> v7;
|
||||
|
||||
protected final ValueValidator<? super A, ? extends R8> v8;
|
||||
|
||||
protected final ValueValidator<? super A, ? extends R9> v9;
|
||||
|
||||
protected final ValueValidator<? super A, ? extends R10> v10;
|
||||
|
||||
protected final ValueValidator<? super A, ? extends R11> v11;
|
||||
|
||||
protected final ValueValidator<? super A, ? extends R12> v12;
|
||||
|
||||
protected final ValueValidator<? super A, ? extends R13> v13;
|
||||
|
||||
protected final ValueValidator<? super A, ? extends R14> v14;
|
||||
|
||||
protected final ValueValidator<? super A, ? extends R15> v15;
|
||||
|
||||
protected final ValueValidator<? super A, ? extends R16> v16;
|
||||
|
||||
public Arguments16Combining(ValueValidator<? super A, ? extends R1> v1,
|
||||
ValueValidator<? super A, ? extends R2> v2,
|
||||
ValueValidator<? super A, ? extends R3> v3,
|
||||
ValueValidator<? super A, ? extends R4> v4,
|
||||
ValueValidator<? super A, ? extends R5> v5,
|
||||
ValueValidator<? super A, ? extends R6> v6,
|
||||
ValueValidator<? super A, ? extends R7> v7,
|
||||
ValueValidator<? super A, ? extends R8> v8,
|
||||
ValueValidator<? super A, ? extends R9> v9,
|
||||
ValueValidator<? super A, ? extends R10> v10,
|
||||
ValueValidator<? super A, ? extends R11> v11,
|
||||
ValueValidator<? super A, ? extends R12> v12,
|
||||
ValueValidator<? super A, ? extends R13> v13,
|
||||
ValueValidator<? super A, ? extends R14> v14,
|
||||
ValueValidator<? super A, ? extends R15> v15,
|
||||
ValueValidator<? super A, ? extends R16> v16) {
|
||||
this.v1 = v1;
|
||||
this.v2 = v2;
|
||||
this.v3 = v3;
|
||||
this.v4 = v4;
|
||||
this.v5 = v5;
|
||||
this.v6 = v6;
|
||||
this.v7 = v7;
|
||||
this.v8 = v8;
|
||||
this.v9 = v9;
|
||||
this.v10 = v10;
|
||||
this.v11 = v11;
|
||||
this.v12 = v12;
|
||||
this.v13 = v13;
|
||||
this.v14 = v14;
|
||||
this.v15 = v15;
|
||||
this.v16 = v16;
|
||||
}
|
||||
|
||||
public <X> Arguments1Validator<A, X> apply(
|
||||
Function16<? super R1, ? super R2, ? super R3, ? super R4, ? super R5, ? super R6, ? super R7, ? super R8, ? super R9, ? super R10, ? super R11, ? super R12, ? super R13, ? super R14, ? super R15, ? super R16, ? extends X> f) {
|
||||
return (a, locale, constraintContext) -> Validations.apply(f::apply,
|
||||
this.v1.validate(a, locale, constraintContext),
|
||||
this.v2.validate(a, locale, constraintContext),
|
||||
this.v3.validate(a, locale, constraintContext),
|
||||
this.v4.validate(a, locale, constraintContext),
|
||||
this.v5.validate(a, locale, constraintContext),
|
||||
this.v6.validate(a, locale, constraintContext),
|
||||
this.v7.validate(a, locale, constraintContext),
|
||||
this.v8.validate(a, locale, constraintContext),
|
||||
this.v9.validate(a, locale, constraintContext),
|
||||
this.v10.validate(a, locale, constraintContext),
|
||||
this.v11.validate(a, locale, constraintContext),
|
||||
this.v12.validate(a, locale, constraintContext),
|
||||
this.v13.validate(a, locale, constraintContext),
|
||||
this.v14.validate(a, locale, constraintContext),
|
||||
this.v15.validate(a, locale, constraintContext),
|
||||
this.v16.validate(a, locale, constraintContext));
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,116 @@
|
|||
/*
|
||||
* Copyright (C) 2018-2022 Toshiaki Maki <makingx@gmail.com>
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.xbib.datastructures.validation.arguments;
|
||||
|
||||
import org.xbib.datastructures.validation.core.ValueValidator;
|
||||
import org.xbib.datastructures.validation.fn.Function16;
|
||||
import org.xbib.datastructures.validation.fn.Validations;
|
||||
|
||||
/**
|
||||
* Generated by https://github.com/making/yavi/blob/develop/scripts/generate-args.sh
|
||||
*
|
||||
* @since 0.7.0
|
||||
*/
|
||||
public class Arguments16Splitting<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, R1, R2, R3, R4, R5, R6, R7, R8, R9, R10, R11, R12, R13, R14, R15, R16> {
|
||||
protected final ValueValidator<? super A1, ? extends R1> v1;
|
||||
|
||||
protected final ValueValidator<? super A2, ? extends R2> v2;
|
||||
|
||||
protected final ValueValidator<? super A3, ? extends R3> v3;
|
||||
|
||||
protected final ValueValidator<? super A4, ? extends R4> v4;
|
||||
|
||||
protected final ValueValidator<? super A5, ? extends R5> v5;
|
||||
|
||||
protected final ValueValidator<? super A6, ? extends R6> v6;
|
||||
|
||||
protected final ValueValidator<? super A7, ? extends R7> v7;
|
||||
|
||||
protected final ValueValidator<? super A8, ? extends R8> v8;
|
||||
|
||||
protected final ValueValidator<? super A9, ? extends R9> v9;
|
||||
|
||||
protected final ValueValidator<? super A10, ? extends R10> v10;
|
||||
|
||||
protected final ValueValidator<? super A11, ? extends R11> v11;
|
||||
|
||||
protected final ValueValidator<? super A12, ? extends R12> v12;
|
||||
|
||||
protected final ValueValidator<? super A13, ? extends R13> v13;
|
||||
|
||||
protected final ValueValidator<? super A14, ? extends R14> v14;
|
||||
|
||||
protected final ValueValidator<? super A15, ? extends R15> v15;
|
||||
|
||||
protected final ValueValidator<? super A16, ? extends R16> v16;
|
||||
|
||||
public Arguments16Splitting(ValueValidator<? super A1, ? extends R1> v1,
|
||||
ValueValidator<? super A2, ? extends R2> v2,
|
||||
ValueValidator<? super A3, ? extends R3> v3,
|
||||
ValueValidator<? super A4, ? extends R4> v4,
|
||||
ValueValidator<? super A5, ? extends R5> v5,
|
||||
ValueValidator<? super A6, ? extends R6> v6,
|
||||
ValueValidator<? super A7, ? extends R7> v7,
|
||||
ValueValidator<? super A8, ? extends R8> v8,
|
||||
ValueValidator<? super A9, ? extends R9> v9,
|
||||
ValueValidator<? super A10, ? extends R10> v10,
|
||||
ValueValidator<? super A11, ? extends R11> v11,
|
||||
ValueValidator<? super A12, ? extends R12> v12,
|
||||
ValueValidator<? super A13, ? extends R13> v13,
|
||||
ValueValidator<? super A14, ? extends R14> v14,
|
||||
ValueValidator<? super A15, ? extends R15> v15,
|
||||
ValueValidator<? super A16, ? extends R16> v16) {
|
||||
this.v1 = v1;
|
||||
this.v2 = v2;
|
||||
this.v3 = v3;
|
||||
this.v4 = v4;
|
||||
this.v5 = v5;
|
||||
this.v6 = v6;
|
||||
this.v7 = v7;
|
||||
this.v8 = v8;
|
||||
this.v9 = v9;
|
||||
this.v10 = v10;
|
||||
this.v11 = v11;
|
||||
this.v12 = v12;
|
||||
this.v13 = v13;
|
||||
this.v14 = v14;
|
||||
this.v15 = v15;
|
||||
this.v16 = v16;
|
||||
}
|
||||
|
||||
public <X> Arguments16Validator<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, X> apply(
|
||||
Function16<? super R1, ? super R2, ? super R3, ? super R4, ? super R5, ? super R6, ? super R7, ? super R8, ? super R9, ? super R10, ? super R11, ? super R12, ? super R13, ? super R14, ? super R15, ? super R16, ? extends X> f) {
|
||||
return (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16,
|
||||
locale, constraintContext) -> Validations.apply(f::apply,
|
||||
this.v1.validate(a1, locale, constraintContext),
|
||||
this.v2.validate(a2, locale, constraintContext),
|
||||
this.v3.validate(a3, locale, constraintContext),
|
||||
this.v4.validate(a4, locale, constraintContext),
|
||||
this.v5.validate(a5, locale, constraintContext),
|
||||
this.v6.validate(a6, locale, constraintContext),
|
||||
this.v7.validate(a7, locale, constraintContext),
|
||||
this.v8.validate(a8, locale, constraintContext),
|
||||
this.v9.validate(a9, locale, constraintContext),
|
||||
this.v10.validate(a10, locale, constraintContext),
|
||||
this.v11.validate(a11, locale, constraintContext),
|
||||
this.v12.validate(a12, locale, constraintContext),
|
||||
this.v13.validate(a13, locale, constraintContext),
|
||||
this.v14.validate(a14, locale, constraintContext),
|
||||
this.v15.validate(a15, locale, constraintContext),
|
||||
this.v16.validate(a16, locale, constraintContext));
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,160 @@
|
|||
/*
|
||||
* Copyright (C) 2018-2022 Toshiaki Maki <makingx@gmail.com>
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.xbib.datastructures.validation.arguments;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import org.xbib.datastructures.validation.core.ConstraintContext;
|
||||
import org.xbib.datastructures.validation.core.ConstraintGroup;
|
||||
import org.xbib.datastructures.validation.core.ConstraintViolationsException;
|
||||
import org.xbib.datastructures.validation.core.Validated;
|
||||
import org.xbib.datastructures.validation.core.ValueValidator;
|
||||
import org.xbib.datastructures.validation.jsr305.Nullable;
|
||||
|
||||
/**
|
||||
* Generated by https://github.com/making/yavi/blob/develop/scripts/generate-args.sh
|
||||
*
|
||||
* @since 0.3.0
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface Arguments16Validator<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, X> {
|
||||
|
||||
Validated<X> validate(@Nullable A1 a1, @Nullable A2 a2, @Nullable A3 a3,
|
||||
@Nullable A4 a4, @Nullable A5 a5, @Nullable A6 a6, @Nullable A7 a7,
|
||||
@Nullable A8 a8, @Nullable A9 a9, @Nullable A10 a10, @Nullable A11 a11,
|
||||
@Nullable A12 a12, @Nullable A13 a13, @Nullable A14 a14, @Nullable A15 a15,
|
||||
@Nullable A16 a16, Locale locale, ConstraintContext constraintContext);
|
||||
|
||||
/**
|
||||
* @since 0.7.0
|
||||
*/
|
||||
default <X2> Arguments16Validator<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, X2> andThen(
|
||||
Function<? super X, ? extends X2> mapper) {
|
||||
return (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16,
|
||||
locale, constraintContext) -> Arguments16Validator.this
|
||||
.validate(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13,
|
||||
a14, a15, a16, locale, constraintContext)
|
||||
.map(mapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 0.11.0
|
||||
*/
|
||||
default <X2> Arguments16Validator<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, X2> andThen(
|
||||
ValueValidator<? super X, X2> validator) {
|
||||
return (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16,
|
||||
locale, constraintContext) -> Arguments16Validator.this
|
||||
.validate(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13,
|
||||
a14, a15, a16, locale, constraintContext)
|
||||
.flatMap(v -> validator.validate(v, locale, constraintContext));
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 0.7.0
|
||||
*/
|
||||
default <A> Arguments1Validator<A, X> compose(
|
||||
Function<? super A, ? extends Arguments16<? extends A1, ? extends A2, ? extends A3, ? extends A4, ? extends A5, ? extends A6, ? extends A7, ? extends A8, ? extends A9, ? extends A10, ? extends A11, ? extends A12, ? extends A13, ? extends A14, ? extends A15, ? extends A16>> mapper) {
|
||||
return (a, locale, constraintContext) -> {
|
||||
final Arguments16<? extends A1, ? extends A2, ? extends A3, ? extends A4, ? extends A5, ? extends A6, ? extends A7, ? extends A8, ? extends A9, ? extends A10, ? extends A11, ? extends A12, ? extends A13, ? extends A14, ? extends A15, ? extends A16> args = mapper
|
||||
.apply(a);
|
||||
return Arguments16Validator.this.validate(args.arg1(), args.arg2(),
|
||||
args.arg3(), args.arg4(), args.arg5(), args.arg6(), args.arg7(),
|
||||
args.arg8(), args.arg9(), args.arg10(), args.arg11(), args.arg12(),
|
||||
args.arg13(), args.arg14(), args.arg15(), args.arg16(), locale,
|
||||
constraintContext);
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 0.10.0
|
||||
*/
|
||||
default Arguments16Validator<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, Supplier<X>> lazy() {
|
||||
// WARNING:: The default implementation is not really lazy!
|
||||
return this.andThen(x -> () -> x);
|
||||
}
|
||||
|
||||
default Validated<X> validate(@Nullable A1 a1, @Nullable A2 a2, @Nullable A3 a3,
|
||||
@Nullable A4 a4, @Nullable A5 a5, @Nullable A6 a6, @Nullable A7 a7,
|
||||
@Nullable A8 a8, @Nullable A9 a9, @Nullable A10 a10, @Nullable A11 a11,
|
||||
@Nullable A12 a12, @Nullable A13 a13, @Nullable A14 a14, @Nullable A15 a15,
|
||||
@Nullable A16 a16) {
|
||||
return this.validate(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14,
|
||||
a15, a16, Locale.getDefault(), ConstraintGroup.DEFAULT);
|
||||
}
|
||||
|
||||
default Validated<X> validate(@Nullable A1 a1, @Nullable A2 a2, @Nullable A3 a3,
|
||||
@Nullable A4 a4, @Nullable A5 a5, @Nullable A6 a6, @Nullable A7 a7,
|
||||
@Nullable A8 a8, @Nullable A9 a9, @Nullable A10 a10, @Nullable A11 a11,
|
||||
@Nullable A12 a12, @Nullable A13 a13, @Nullable A14 a14, @Nullable A15 a15,
|
||||
@Nullable A16 a16, ConstraintContext constraintContext) {
|
||||
return this.validate(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14,
|
||||
a15, a16, Locale.getDefault(), constraintContext);
|
||||
}
|
||||
|
||||
default Validated<X> validate(@Nullable A1 a1, @Nullable A2 a2, @Nullable A3 a3,
|
||||
@Nullable A4 a4, @Nullable A5 a5, @Nullable A6 a6, @Nullable A7 a7,
|
||||
@Nullable A8 a8, @Nullable A9 a9, @Nullable A10 a10, @Nullable A11 a11,
|
||||
@Nullable A12 a12, @Nullable A13 a13, @Nullable A14 a14, @Nullable A15 a15,
|
||||
@Nullable A16 a16, Locale locale) {
|
||||
return this.validate(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14,
|
||||
a15, a16, locale, ConstraintGroup.DEFAULT);
|
||||
}
|
||||
|
||||
default X validated(@Nullable A1 a1, @Nullable A2 a2, @Nullable A3 a3,
|
||||
@Nullable A4 a4, @Nullable A5 a5, @Nullable A6 a6, @Nullable A7 a7,
|
||||
@Nullable A8 a8, @Nullable A9 a9, @Nullable A10 a10, @Nullable A11 a11,
|
||||
@Nullable A12 a12, @Nullable A13 a13, @Nullable A14 a14, @Nullable A15 a15,
|
||||
@Nullable A16 a16) throws ConstraintViolationsException {
|
||||
return this.validate(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14,
|
||||
a15, a16).orElseThrow(ConstraintViolationsException::new);
|
||||
}
|
||||
|
||||
default X validated(@Nullable A1 a1, @Nullable A2 a2, @Nullable A3 a3,
|
||||
@Nullable A4 a4, @Nullable A5 a5, @Nullable A6 a6, @Nullable A7 a7,
|
||||
@Nullable A8 a8, @Nullable A9 a9, @Nullable A10 a10, @Nullable A11 a11,
|
||||
@Nullable A12 a12, @Nullable A13 a13, @Nullable A14 a14, @Nullable A15 a15,
|
||||
@Nullable A16 a16, ConstraintContext constraintContext)
|
||||
throws ConstraintViolationsException {
|
||||
return this
|
||||
.validate(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14,
|
||||
a15, a16, constraintContext)
|
||||
.orElseThrow(ConstraintViolationsException::new);
|
||||
}
|
||||
|
||||
default X validated(@Nullable A1 a1, @Nullable A2 a2, @Nullable A3 a3,
|
||||
@Nullable A4 a4, @Nullable A5 a5, @Nullable A6 a6, @Nullable A7 a7,
|
||||
@Nullable A8 a8, @Nullable A9 a9, @Nullable A10 a10, @Nullable A11 a11,
|
||||
@Nullable A12 a12, @Nullable A13 a13, @Nullable A14 a14, @Nullable A15 a15,
|
||||
@Nullable A16 a16, Locale locale) throws ConstraintViolationsException {
|
||||
return this.validate(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14,
|
||||
a15, a16, locale).orElseThrow(ConstraintViolationsException::new);
|
||||
}
|
||||
|
||||
default X validated(@Nullable A1 a1, @Nullable A2 a2, @Nullable A3 a3,
|
||||
@Nullable A4 a4, @Nullable A5 a5, @Nullable A6 a6, @Nullable A7 a7,
|
||||
@Nullable A8 a8, @Nullable A9 a9, @Nullable A10 a10, @Nullable A11 a11,
|
||||
@Nullable A12 a12, @Nullable A13 a13, @Nullable A14 a14, @Nullable A15 a15,
|
||||
@Nullable A16 a16, Locale locale, ConstraintContext constraintContext)
|
||||
throws ConstraintViolationsException {
|
||||
return this
|
||||
.validate(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14,
|
||||
a15, a16, locale, constraintContext)
|
||||
.orElseThrow(ConstraintViolationsException::new);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,175 @@
|
|||
package org.xbib.datastructures.validation.arguments;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import org.xbib.datastructures.validation.core.ConstraintContext;
|
||||
import org.xbib.datastructures.validation.core.ConstraintGroup;
|
||||
import org.xbib.datastructures.validation.core.ConstraintViolationsException;
|
||||
import org.xbib.datastructures.validation.core.Validatable;
|
||||
import org.xbib.datastructures.validation.core.Validated;
|
||||
import org.xbib.datastructures.validation.core.ValueValidator;
|
||||
import org.xbib.datastructures.validation.jsr305.Nullable;
|
||||
|
||||
@FunctionalInterface
|
||||
public interface Arguments1Validator<A1, X> extends ValueValidator<A1, X> {
|
||||
|
||||
/**
|
||||
* Convert {@link Validatable} instance into {@link Arguments1Validator}
|
||||
*
|
||||
* @param validator core validator
|
||||
* @param <X> target class
|
||||
* @return arguments1 validator
|
||||
* @since 0.8.0
|
||||
*/
|
||||
static <X> Arguments1Validator<X, X> from(Validatable<X> validator) {
|
||||
return Arguments1Validator.from(validator.applicative());
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert {@link ValueValidator} instance into {@link Arguments1Validator}
|
||||
*
|
||||
* @param valueValidator value validator
|
||||
* @param <A1> class of argument1
|
||||
* @param <X> target class
|
||||
* @return arguments1 validator
|
||||
* @since 0.8.0
|
||||
*/
|
||||
static <A1, X> Arguments1Validator<A1, X> from(ValueValidator<A1, X> valueValidator) {
|
||||
return valueValidator::validate;
|
||||
}
|
||||
|
||||
@Override
|
||||
Validated<X> validate(@Nullable A1 a1, Locale locale,
|
||||
ConstraintContext constraintContext);
|
||||
|
||||
/**
|
||||
* @since 0.7.0
|
||||
*/
|
||||
@Override
|
||||
default <X2> Arguments1Validator<A1, X2> andThen(
|
||||
Function<? super X, ? extends X2> mapper) {
|
||||
return (a1, locale, constraintContext) -> Arguments1Validator.this
|
||||
.validate(a1, locale, constraintContext).map(mapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 0.11.0
|
||||
*/
|
||||
@Override
|
||||
default <X2> Arguments1Validator<A1, X2> andThen(
|
||||
ValueValidator<? super X, X2> validator) {
|
||||
return (a1, locale, constraintContext) -> Arguments1Validator.this
|
||||
.validate(a1, locale, constraintContext)
|
||||
.flatMap(v -> validator.validate(v, locale, constraintContext));
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 0.7.0
|
||||
*/
|
||||
@Override
|
||||
default <A> Arguments1Validator<A, X> compose(
|
||||
Function<? super A, ? extends A1> mapper) {
|
||||
return (a, locale, constraintContext) -> Arguments1Validator.this
|
||||
.validate(mapper.apply(a), locale, constraintContext);
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 0.10.0
|
||||
*/
|
||||
default Arguments1Validator<A1, Supplier<X>> lazy() {
|
||||
// WARNING:: The default implementation is not really lazy!
|
||||
return this.andThen(x -> () -> x);
|
||||
}
|
||||
|
||||
default Validated<X> validate(@Nullable A1 a1) {
|
||||
return this.validate(a1, Locale.getDefault(), ConstraintGroup.DEFAULT);
|
||||
}
|
||||
|
||||
default Validated<X> validate(@Nullable A1 a1, ConstraintContext constraintContext) {
|
||||
return this.validate(a1, Locale.getDefault(), constraintContext);
|
||||
}
|
||||
|
||||
default Validated<X> validate(@Nullable A1 a1, Locale locale) {
|
||||
return this.validate(a1, locale, ConstraintGroup.DEFAULT);
|
||||
}
|
||||
|
||||
default X validated(@Nullable A1 a1) throws ConstraintViolationsException {
|
||||
return this.validate(a1).orElseThrow(ConstraintViolationsException::new);
|
||||
}
|
||||
|
||||
default X validated(@Nullable A1 a1, ConstraintContext constraintContext)
|
||||
throws ConstraintViolationsException {
|
||||
return this.validate(a1, constraintContext)
|
||||
.orElseThrow(ConstraintViolationsException::new);
|
||||
}
|
||||
|
||||
default X validated(@Nullable A1 a1, Locale locale)
|
||||
throws ConstraintViolationsException {
|
||||
return this.validate(a1, locale).orElseThrow(ConstraintViolationsException::new);
|
||||
}
|
||||
|
||||
default X validated(@Nullable A1 a1, Locale locale,
|
||||
ConstraintContext constraintContext) throws ConstraintViolationsException {
|
||||
return this.validate(a1, locale, constraintContext)
|
||||
.orElseThrow(ConstraintViolationsException::new);
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 0.7.0
|
||||
*/
|
||||
default <A2, Y> Arguments2Splitting<A1, A2, X, Y> split(
|
||||
ValueValidator<A2, Y> validator) {
|
||||
return new Arguments2Splitting<>(this, validator);
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 0.7.0
|
||||
*/
|
||||
default <Y> Arguments2Combining<A1, X, Y> combine(ValueValidator<A1, Y> validator) {
|
||||
return new Arguments2Combining<>(this, validator);
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 0.7.0
|
||||
*/
|
||||
@Override
|
||||
default Arguments1Validator<A1, X> indexed(int index) {
|
||||
return (a1, locale, constraintContext) -> Arguments1Validator.this
|
||||
.validate(a1, locale, constraintContext).indexed(index);
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 0.8.0
|
||||
*/
|
||||
default <C extends Collection<X>> Arguments1Validator<Iterable<A1>, C> liftCollection(
|
||||
Supplier<C> factory) {
|
||||
return Arguments1Validator.from(ValueValidator.super.liftCollection(factory));
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 0.8.0
|
||||
*/
|
||||
default Arguments1Validator<Iterable<A1>, List<X>> liftList() {
|
||||
return Arguments1Validator.from(ValueValidator.super.liftList());
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 0.8.0
|
||||
*/
|
||||
default Arguments1Validator<Iterable<A1>, Set<X>> liftSet() {
|
||||
return Arguments1Validator.from(ValueValidator.super.liftSet());
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 0.8.0
|
||||
*/
|
||||
default Arguments1Validator<Optional<A1>, Optional<X>> liftOptional() {
|
||||
return Arguments1Validator.from(ValueValidator.super.liftOptional());
|
||||
}
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
package org.xbib.datastructures.validation.arguments;
|
||||
|
||||
import org.xbib.datastructures.validation.fn.Function2;
|
||||
import org.xbib.datastructures.validation.jsr305.Nullable;
|
||||
|
||||
public class Arguments2<A1, A2> extends Arguments1<A1> {
|
||||
|
||||
protected final A2 arg2;
|
||||
|
||||
Arguments2(@Nullable A1 arg1, @Nullable A2 arg2) {
|
||||
super(arg1);
|
||||
this.arg2 = arg2;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public final A2 arg2() {
|
||||
return this.arg2;
|
||||
}
|
||||
|
||||
public final <X> X map(Function2<? super A1, ? super A2, ? extends X> mapper) {
|
||||
return mapper.apply(arg1, arg2);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
package org.xbib.datastructures.validation.arguments;
|
||||
|
||||
import org.xbib.datastructures.validation.core.ValueValidator;
|
||||
import org.xbib.datastructures.validation.fn.Function2;
|
||||
import org.xbib.datastructures.validation.fn.Validations;
|
||||
|
||||
public class Arguments2Combining<A, R1, R2> {
|
||||
protected final ValueValidator<? super A, ? extends R1> v1;
|
||||
|
||||
protected final ValueValidator<? super A, ? extends R2> v2;
|
||||
|
||||
public Arguments2Combining(ValueValidator<? super A, ? extends R1> v1,
|
||||
ValueValidator<? super A, ? extends R2> v2) {
|
||||
this.v1 = v1;
|
||||
this.v2 = v2;
|
||||
}
|
||||
|
||||
public <X> Arguments1Validator<A, X> apply(
|
||||
Function2<? super R1, ? super R2, ? extends X> f) {
|
||||
return (a, locale, constraintContext) -> Validations.apply(f::apply,
|
||||
this.v1.validate(a, locale, constraintContext),
|
||||
this.v2.validate(a, locale, constraintContext));
|
||||
}
|
||||
|
||||
public <R3> Arguments3Combining<A, R1, R2, R3> combine(
|
||||
ValueValidator<? super A, ? extends R3> v3) {
|
||||
return new Arguments3Combining<>(v1, v2, v3);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
package org.xbib.datastructures.validation.arguments;
|
||||
|
||||
import org.xbib.datastructures.validation.core.ValueValidator;
|
||||
import org.xbib.datastructures.validation.fn.Function2;
|
||||
import org.xbib.datastructures.validation.fn.Validations;
|
||||
|
||||
public class Arguments2Splitting<A1, A2, R1, R2> {
|
||||
protected final ValueValidator<? super A1, ? extends R1> v1;
|
||||
|
||||
protected final ValueValidator<? super A2, ? extends R2> v2;
|
||||
|
||||
public Arguments2Splitting(ValueValidator<? super A1, ? extends R1> v1,
|
||||
ValueValidator<? super A2, ? extends R2> v2) {
|
||||
this.v1 = v1;
|
||||
this.v2 = v2;
|
||||
}
|
||||
|
||||
public <X> Arguments2Validator<A1, A2, X> apply(
|
||||
Function2<? super R1, ? super R2, ? extends X> f) {
|
||||
return (a1, a2, locale, constraintContext) -> Validations.apply(f::apply,
|
||||
this.v1.validate(a1, locale, constraintContext),
|
||||
this.v2.validate(a2, locale, constraintContext));
|
||||
}
|
||||
|
||||
public <A3, R3> Arguments3Splitting<A1, A2, A3, R1, R2, R3> split(
|
||||
ValueValidator<? super A3, ? extends R3> v3) {
|
||||
return new Arguments3Splitting<>(v1, v2, v3);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,83 @@
|
|||
package org.xbib.datastructures.validation.arguments;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import org.xbib.datastructures.validation.core.ConstraintContext;
|
||||
import org.xbib.datastructures.validation.core.ConstraintGroup;
|
||||
import org.xbib.datastructures.validation.core.ConstraintViolationsException;
|
||||
import org.xbib.datastructures.validation.core.Validated;
|
||||
import org.xbib.datastructures.validation.core.ValueValidator;
|
||||
import org.xbib.datastructures.validation.jsr305.Nullable;
|
||||
|
||||
@FunctionalInterface
|
||||
public interface Arguments2Validator<A1, A2, X> {
|
||||
|
||||
Validated<X> validate(@Nullable A1 a1, @Nullable A2 a2, Locale locale,
|
||||
ConstraintContext constraintContext);
|
||||
|
||||
default <X2> Arguments2Validator<A1, A2, X2> andThen(
|
||||
Function<? super X, ? extends X2> mapper) {
|
||||
return (a1, a2, locale, constraintContext) -> Arguments2Validator.this
|
||||
.validate(a1, a2, locale, constraintContext).map(mapper);
|
||||
}
|
||||
|
||||
default <X2> Arguments2Validator<A1, A2, X2> andThen(
|
||||
ValueValidator<? super X, X2> validator) {
|
||||
return (a1, a2, locale, constraintContext) -> Arguments2Validator.this
|
||||
.validate(a1, a2, locale, constraintContext)
|
||||
.flatMap(v -> validator.validate(v, locale, constraintContext));
|
||||
}
|
||||
|
||||
default <A> Arguments1Validator<A, X> compose(
|
||||
Function<? super A, ? extends Arguments2<? extends A1, ? extends A2>> mapper) {
|
||||
return (a, locale, constraintContext) -> {
|
||||
final Arguments2<? extends A1, ? extends A2> args = mapper.apply(a);
|
||||
return Arguments2Validator.this.validate(args.arg1(), args.arg2(), locale,
|
||||
constraintContext);
|
||||
};
|
||||
}
|
||||
|
||||
default Arguments2Validator<A1, A2, Supplier<X>> lazy() {
|
||||
// WARNING:: The default implementation is not really lazy!
|
||||
return this.andThen(x -> () -> x);
|
||||
}
|
||||
|
||||
default Validated<X> validate(@Nullable A1 a1, @Nullable A2 a2) {
|
||||
return this.validate(a1, a2, Locale.getDefault(), ConstraintGroup.DEFAULT);
|
||||
}
|
||||
|
||||
default Validated<X> validate(@Nullable A1 a1, @Nullable A2 a2,
|
||||
ConstraintContext constraintContext) {
|
||||
return this.validate(a1, a2, Locale.getDefault(), constraintContext);
|
||||
}
|
||||
|
||||
default Validated<X> validate(@Nullable A1 a1, @Nullable A2 a2, Locale locale) {
|
||||
return this.validate(a1, a2, locale, ConstraintGroup.DEFAULT);
|
||||
}
|
||||
|
||||
default X validated(@Nullable A1 a1, @Nullable A2 a2)
|
||||
throws ConstraintViolationsException {
|
||||
return this.validate(a1, a2).orElseThrow(ConstraintViolationsException::new);
|
||||
}
|
||||
|
||||
default X validated(@Nullable A1 a1, @Nullable A2 a2,
|
||||
ConstraintContext constraintContext) throws ConstraintViolationsException {
|
||||
return this.validate(a1, a2, constraintContext)
|
||||
.orElseThrow(ConstraintViolationsException::new);
|
||||
}
|
||||
|
||||
default X validated(@Nullable A1 a1, @Nullable A2 a2, Locale locale)
|
||||
throws ConstraintViolationsException {
|
||||
return this.validate(a1, a2, locale)
|
||||
.orElseThrow(ConstraintViolationsException::new);
|
||||
}
|
||||
|
||||
default X validated(@Nullable A1 a1, @Nullable A2 a2, Locale locale,
|
||||
ConstraintContext constraintContext) throws ConstraintViolationsException {
|
||||
return this.validate(a1, a2, locale, constraintContext)
|
||||
.orElseThrow(ConstraintViolationsException::new);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
package org.xbib.datastructures.validation.arguments;
|
||||
|
||||
import org.xbib.datastructures.validation.fn.Function3;
|
||||
import org.xbib.datastructures.validation.jsr305.Nullable;
|
||||
|
||||
public class Arguments3<A1, A2, A3> extends Arguments2<A1, A2> {
|
||||
|
||||
protected final A3 arg3;
|
||||
|
||||
Arguments3(@Nullable A1 arg1, @Nullable A2 arg2, @Nullable A3 arg3) {
|
||||
super(arg1, arg2);
|
||||
this.arg3 = arg3;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public final A3 arg3() {
|
||||
return this.arg3;
|
||||
}
|
||||
|
||||
public final <X> X map(
|
||||
Function3<? super A1, ? super A2, ? super A3, ? extends X> mapper) {
|
||||
return mapper.apply(arg1, arg2, arg3);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
package org.xbib.datastructures.validation.arguments;
|
||||
|
||||
import org.xbib.datastructures.validation.core.ValueValidator;
|
||||
import org.xbib.datastructures.validation.fn.Function3;
|
||||
import org.xbib.datastructures.validation.fn.Validations;
|
||||
|
||||
public class Arguments3Combining<A, R1, R2, R3> {
|
||||
protected final ValueValidator<? super A, ? extends R1> v1;
|
||||
|
||||
protected final ValueValidator<? super A, ? extends R2> v2;
|
||||
|
||||
protected final ValueValidator<? super A, ? extends R3> v3;
|
||||
|
||||
public Arguments3Combining(ValueValidator<? super A, ? extends R1> v1,
|
||||
ValueValidator<? super A, ? extends R2> v2,
|
||||
ValueValidator<? super A, ? extends R3> v3) {
|
||||
this.v1 = v1;
|
||||
this.v2 = v2;
|
||||
this.v3 = v3;
|
||||
}
|
||||
|
||||
public <X> Arguments1Validator<A, X> apply(
|
||||
Function3<? super R1, ? super R2, ? super R3, ? extends X> f) {
|
||||
return (a, locale, constraintContext) -> Validations.apply(f::apply,
|
||||
this.v1.validate(a, locale, constraintContext),
|
||||
this.v2.validate(a, locale, constraintContext),
|
||||
this.v3.validate(a, locale, constraintContext));
|
||||
}
|
||||
|
||||
public <R4> Arguments4Combining<A, R1, R2, R3, R4> combine(
|
||||
ValueValidator<? super A, ? extends R4> v4) {
|
||||
return new Arguments4Combining<>(v1, v2, v3, v4);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
package org.xbib.datastructures.validation.arguments;
|
||||
|
||||
import org.xbib.datastructures.validation.core.ValueValidator;
|
||||
import org.xbib.datastructures.validation.fn.Function3;
|
||||
import org.xbib.datastructures.validation.fn.Validations;
|
||||
|
||||
public class Arguments3Splitting<A1, A2, A3, R1, R2, R3> {
|
||||
protected final ValueValidator<? super A1, ? extends R1> v1;
|
||||
|
||||
protected final ValueValidator<? super A2, ? extends R2> v2;
|
||||
|
||||
protected final ValueValidator<? super A3, ? extends R3> v3;
|
||||
|
||||
public Arguments3Splitting(ValueValidator<? super A1, ? extends R1> v1,
|
||||
ValueValidator<? super A2, ? extends R2> v2,
|
||||
ValueValidator<? super A3, ? extends R3> v3) {
|
||||
this.v1 = v1;
|
||||
this.v2 = v2;
|
||||
this.v3 = v3;
|
||||
}
|
||||
|
||||
public <X> Arguments3Validator<A1, A2, A3, X> apply(
|
||||
Function3<? super R1, ? super R2, ? super R3, ? extends X> f) {
|
||||
return (a1, a2, a3, locale, constraintContext) -> Validations.apply(f::apply,
|
||||
this.v1.validate(a1, locale, constraintContext),
|
||||
this.v2.validate(a2, locale, constraintContext),
|
||||
this.v3.validate(a3, locale, constraintContext));
|
||||
}
|
||||
|
||||
public <A4, R4> Arguments4Splitting<A1, A2, A3, A4, R1, R2, R3, R4> split(
|
||||
ValueValidator<? super A4, ? extends R4> v4) {
|
||||
return new Arguments4Splitting<>(v1, v2, v3, v4);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,85 @@
|
|||
package org.xbib.datastructures.validation.arguments;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import org.xbib.datastructures.validation.core.ConstraintContext;
|
||||
import org.xbib.datastructures.validation.core.ConstraintGroup;
|
||||
import org.xbib.datastructures.validation.core.ConstraintViolationsException;
|
||||
import org.xbib.datastructures.validation.core.Validated;
|
||||
import org.xbib.datastructures.validation.core.ValueValidator;
|
||||
import org.xbib.datastructures.validation.jsr305.Nullable;
|
||||
|
||||
@FunctionalInterface
|
||||
public interface Arguments3Validator<A1, A2, A3, X> {
|
||||
|
||||
Validated<X> validate(@Nullable A1 a1, @Nullable A2 a2, @Nullable A3 a3,
|
||||
Locale locale, ConstraintContext constraintContext);
|
||||
|
||||
default <X2> Arguments3Validator<A1, A2, A3, X2> andThen(
|
||||
Function<? super X, ? extends X2> mapper) {
|
||||
return (a1, a2, a3, locale, constraintContext) -> Arguments3Validator.this
|
||||
.validate(a1, a2, a3, locale, constraintContext).map(mapper);
|
||||
}
|
||||
|
||||
default <X2> Arguments3Validator<A1, A2, A3, X2> andThen(
|
||||
ValueValidator<? super X, X2> validator) {
|
||||
return (a1, a2, a3, locale, constraintContext) -> Arguments3Validator.this
|
||||
.validate(a1, a2, a3, locale, constraintContext)
|
||||
.flatMap(v -> validator.validate(v, locale, constraintContext));
|
||||
}
|
||||
|
||||
default <A> Arguments1Validator<A, X> compose(
|
||||
Function<? super A, ? extends Arguments3<? extends A1, ? extends A2, ? extends A3>> mapper) {
|
||||
return (a, locale, constraintContext) -> {
|
||||
final Arguments3<? extends A1, ? extends A2, ? extends A3> args = mapper
|
||||
.apply(a);
|
||||
return Arguments3Validator.this.validate(args.arg1(), args.arg2(),
|
||||
args.arg3(), locale, constraintContext);
|
||||
};
|
||||
}
|
||||
|
||||
default Arguments3Validator<A1, A2, A3, Supplier<X>> lazy() {
|
||||
// WARNING:: The default implementation is not really lazy!
|
||||
return this.andThen(x -> () -> x);
|
||||
}
|
||||
|
||||
default Validated<X> validate(@Nullable A1 a1, @Nullable A2 a2, @Nullable A3 a3) {
|
||||
return this.validate(a1, a2, a3, Locale.getDefault(), ConstraintGroup.DEFAULT);
|
||||
}
|
||||
|
||||
default Validated<X> validate(@Nullable A1 a1, @Nullable A2 a2, @Nullable A3 a3,
|
||||
ConstraintContext constraintContext) {
|
||||
return this.validate(a1, a2, a3, Locale.getDefault(), constraintContext);
|
||||
}
|
||||
|
||||
default Validated<X> validate(@Nullable A1 a1, @Nullable A2 a2, @Nullable A3 a3,
|
||||
Locale locale) {
|
||||
return this.validate(a1, a2, a3, locale, ConstraintGroup.DEFAULT);
|
||||
}
|
||||
|
||||
default X validated(@Nullable A1 a1, @Nullable A2 a2, @Nullable A3 a3)
|
||||
throws ConstraintViolationsException {
|
||||
return this.validate(a1, a2, a3).orElseThrow(ConstraintViolationsException::new);
|
||||
}
|
||||
|
||||
default X validated(@Nullable A1 a1, @Nullable A2 a2, @Nullable A3 a3,
|
||||
ConstraintContext constraintContext) throws ConstraintViolationsException {
|
||||
return this.validate(a1, a2, a3, constraintContext)
|
||||
.orElseThrow(ConstraintViolationsException::new);
|
||||
}
|
||||
|
||||
default X validated(@Nullable A1 a1, @Nullable A2 a2, @Nullable A3 a3, Locale locale)
|
||||
throws ConstraintViolationsException {
|
||||
return this.validate(a1, a2, a3, locale)
|
||||
.orElseThrow(ConstraintViolationsException::new);
|
||||
}
|
||||
|
||||
default X validated(@Nullable A1 a1, @Nullable A2 a2, @Nullable A3 a3, Locale locale,
|
||||
ConstraintContext constraintContext) throws ConstraintViolationsException {
|
||||
return this.validate(a1, a2, a3, locale, constraintContext)
|
||||
.orElseThrow(ConstraintViolationsException::new);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
package org.xbib.datastructures.validation.arguments;
|
||||
|
||||
import org.xbib.datastructures.validation.fn.Function4;
|
||||
import org.xbib.datastructures.validation.jsr305.Nullable;
|
||||
|
||||
public class Arguments4<A1, A2, A3, A4> extends Arguments3<A1, A2, A3> {
|
||||
|
||||
protected final A4 arg4;
|
||||
|
||||
Arguments4(@Nullable A1 arg1, @Nullable A2 arg2, @Nullable A3 arg3,
|
||||
@Nullable A4 arg4) {
|
||||
super(arg1, arg2, arg3);
|
||||
this.arg4 = arg4;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public final A4 arg4() {
|
||||
return this.arg4;
|
||||
}
|
||||
|
||||
public final <X> X map(
|
||||
Function4<? super A1, ? super A2, ? super A3, ? super A4, ? extends X> mapper) {
|
||||
return mapper.apply(arg1, arg2, arg3, arg4);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
package org.xbib.datastructures.validation.arguments;
|
||||
|
||||
import org.xbib.datastructures.validation.core.ValueValidator;
|
||||
import org.xbib.datastructures.validation.fn.Function4;
|
||||
import org.xbib.datastructures.validation.fn.Validations;
|
||||
|
||||
public class Arguments4Combining<A, R1, R2, R3, R4> {
|
||||
protected final ValueValidator<? super A, ? extends R1> v1;
|
||||
|
||||
protected final ValueValidator<? super A, ? extends R2> v2;
|
||||
|
||||
protected final ValueValidator<? super A, ? extends R3> v3;
|
||||
|
||||
protected final ValueValidator<? super A, ? extends R4> v4;
|
||||
|
||||
public Arguments4Combining(ValueValidator<? super A, ? extends R1> v1,
|
||||
ValueValidator<? super A, ? extends R2> v2,
|
||||
ValueValidator<? super A, ? extends R3> v3,
|
||||
ValueValidator<? super A, ? extends R4> v4) {
|
||||
this.v1 = v1;
|
||||
this.v2 = v2;
|
||||
this.v3 = v3;
|
||||
this.v4 = v4;
|
||||
}
|
||||
|
||||
public <X> Arguments1Validator<A, X> apply(
|
||||
Function4<? super R1, ? super R2, ? super R3, ? super R4, ? extends X> f) {
|
||||
return (a, locale, constraintContext) -> Validations.apply(f::apply,
|
||||
this.v1.validate(a, locale, constraintContext),
|
||||
this.v2.validate(a, locale, constraintContext),
|
||||
this.v3.validate(a, locale, constraintContext),
|
||||
this.v4.validate(a, locale, constraintContext));
|
||||
}
|
||||
|
||||
public <R5> Arguments5Combining<A, R1, R2, R3, R4, R5> combine(
|
||||
ValueValidator<? super A, ? extends R5> v5) {
|
||||
return new Arguments5Combining<>(v1, v2, v3, v4, v5);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
package org.xbib.datastructures.validation.arguments;
|
||||
|
||||
import org.xbib.datastructures.validation.core.ValueValidator;
|
||||
import org.xbib.datastructures.validation.fn.Function4;
|
||||
import org.xbib.datastructures.validation.fn.Validations;
|
||||
|
||||
public class Arguments4Splitting<A1, A2, A3, A4, R1, R2, R3, R4> {
|
||||
protected final ValueValidator<? super A1, ? extends R1> v1;
|
||||
|
||||
protected final ValueValidator<? super A2, ? extends R2> v2;
|
||||
|
||||
protected final ValueValidator<? super A3, ? extends R3> v3;
|
||||
|
||||
protected final ValueValidator<? super A4, ? extends R4> v4;
|
||||
|
||||
public Arguments4Splitting(ValueValidator<? super A1, ? extends R1> v1,
|
||||
ValueValidator<? super A2, ? extends R2> v2,
|
||||
ValueValidator<? super A3, ? extends R3> v3,
|
||||
ValueValidator<? super A4, ? extends R4> v4) {
|
||||
this.v1 = v1;
|
||||
this.v2 = v2;
|
||||
this.v3 = v3;
|
||||
this.v4 = v4;
|
||||
}
|
||||
|
||||
public <X> Arguments4Validator<A1, A2, A3, A4, X> apply(
|
||||
Function4<? super R1, ? super R2, ? super R3, ? super R4, ? extends X> f) {
|
||||
return (a1, a2, a3, a4, locale, constraintContext) -> Validations.apply(f::apply,
|
||||
this.v1.validate(a1, locale, constraintContext),
|
||||
this.v2.validate(a2, locale, constraintContext),
|
||||
this.v3.validate(a3, locale, constraintContext),
|
||||
this.v4.validate(a4, locale, constraintContext));
|
||||
}
|
||||
|
||||
public <A5, R5> Arguments5Splitting<A1, A2, A3, A4, A5, R1, R2, R3, R4, R5> split(
|
||||
ValueValidator<? super A5, ? extends R5> v5) {
|
||||
return new Arguments5Splitting<>(v1, v2, v3, v4, v5);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,122 @@
|
|||
/*
|
||||
* Copyright (C) 2018-2022 Toshiaki Maki <makingx@gmail.com>
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.xbib.datastructures.validation.arguments;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import org.xbib.datastructures.validation.core.ConstraintContext;
|
||||
import org.xbib.datastructures.validation.core.ConstraintGroup;
|
||||
import org.xbib.datastructures.validation.core.ConstraintViolationsException;
|
||||
import org.xbib.datastructures.validation.core.Validated;
|
||||
import org.xbib.datastructures.validation.core.ValueValidator;
|
||||
import org.xbib.datastructures.validation.jsr305.Nullable;
|
||||
|
||||
/**
|
||||
* Generated by https://github.com/making/yavi/blob/develop/scripts/generate-args.sh
|
||||
*
|
||||
* @since 0.3.0
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface Arguments4Validator<A1, A2, A3, A4, X> {
|
||||
|
||||
Validated<X> validate(@Nullable A1 a1, @Nullable A2 a2, @Nullable A3 a3,
|
||||
@Nullable A4 a4, Locale locale, ConstraintContext constraintContext);
|
||||
|
||||
/**
|
||||
* @since 0.7.0
|
||||
*/
|
||||
default <X2> Arguments4Validator<A1, A2, A3, A4, X2> andThen(
|
||||
Function<? super X, ? extends X2> mapper) {
|
||||
return (a1, a2, a3, a4, locale, constraintContext) -> Arguments4Validator.this
|
||||
.validate(a1, a2, a3, a4, locale, constraintContext).map(mapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 0.11.0
|
||||
*/
|
||||
default <X2> Arguments4Validator<A1, A2, A3, A4, X2> andThen(
|
||||
ValueValidator<? super X, X2> validator) {
|
||||
return (a1, a2, a3, a4, locale, constraintContext) -> Arguments4Validator.this
|
||||
.validate(a1, a2, a3, a4, locale, constraintContext)
|
||||
.flatMap(v -> validator.validate(v, locale, constraintContext));
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 0.7.0
|
||||
*/
|
||||
default <A> Arguments1Validator<A, X> compose(
|
||||
Function<? super A, ? extends Arguments4<? extends A1, ? extends A2, ? extends A3, ? extends A4>> mapper) {
|
||||
return (a, locale, constraintContext) -> {
|
||||
final Arguments4<? extends A1, ? extends A2, ? extends A3, ? extends A4> args = mapper
|
||||
.apply(a);
|
||||
return Arguments4Validator.this.validate(args.arg1(), args.arg2(),
|
||||
args.arg3(), args.arg4(), locale, constraintContext);
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 0.10.0
|
||||
*/
|
||||
default Arguments4Validator<A1, A2, A3, A4, Supplier<X>> lazy() {
|
||||
// WARNING:: The default implementation is not really lazy!
|
||||
return this.andThen(x -> () -> x);
|
||||
}
|
||||
|
||||
default Validated<X> validate(@Nullable A1 a1, @Nullable A2 a2, @Nullable A3 a3,
|
||||
@Nullable A4 a4) {
|
||||
return this.validate(a1, a2, a3, a4, Locale.getDefault(),
|
||||
ConstraintGroup.DEFAULT);
|
||||
}
|
||||
|
||||
default Validated<X> validate(@Nullable A1 a1, @Nullable A2 a2, @Nullable A3 a3,
|
||||
@Nullable A4 a4, ConstraintContext constraintContext) {
|
||||
return this.validate(a1, a2, a3, a4, Locale.getDefault(), constraintContext);
|
||||
}
|
||||
|
||||
default Validated<X> validate(@Nullable A1 a1, @Nullable A2 a2, @Nullable A3 a3,
|
||||
@Nullable A4 a4, Locale locale) {
|
||||
return this.validate(a1, a2, a3, a4, locale, ConstraintGroup.DEFAULT);
|
||||
}
|
||||
|
||||
default X validated(@Nullable A1 a1, @Nullable A2 a2, @Nullable A3 a3,
|
||||
@Nullable A4 a4) throws ConstraintViolationsException {
|
||||
return this.validate(a1, a2, a3, a4)
|
||||
.orElseThrow(ConstraintViolationsException::new);
|
||||
}
|
||||
|
||||
default X validated(@Nullable A1 a1, @Nullable A2 a2, @Nullable A3 a3,
|
||||
@Nullable A4 a4, ConstraintContext constraintContext)
|
||||
throws ConstraintViolationsException {
|
||||
return this.validate(a1, a2, a3, a4, constraintContext)
|
||||
.orElseThrow(ConstraintViolationsException::new);
|
||||
}
|
||||
|
||||
default X validated(@Nullable A1 a1, @Nullable A2 a2, @Nullable A3 a3,
|
||||
@Nullable A4 a4, Locale locale) throws ConstraintViolationsException {
|
||||
return this.validate(a1, a2, a3, a4, locale)
|
||||
.orElseThrow(ConstraintViolationsException::new);
|
||||
}
|
||||
|
||||
default X validated(@Nullable A1 a1, @Nullable A2 a2, @Nullable A3 a3,
|
||||
@Nullable A4 a4, Locale locale, ConstraintContext constraintContext)
|
||||
throws ConstraintViolationsException {
|
||||
return this.validate(a1, a2, a3, a4, locale, constraintContext)
|
||||
.orElseThrow(ConstraintViolationsException::new);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
/*
|
||||
* Copyright (C) 2018-2022 Toshiaki Maki <makingx@gmail.com>
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.xbib.datastructures.validation.arguments;
|
||||
|
||||
import org.xbib.datastructures.validation.fn.Function5;
|
||||
import org.xbib.datastructures.validation.jsr305.Nullable;
|
||||
|
||||
/**
|
||||
* Generated by https://github.com/making/yavi/blob/develop/scripts/generate-args.sh
|
||||
*
|
||||
* @since 0.3.0
|
||||
*/
|
||||
public class Arguments5<A1, A2, A3, A4, A5> extends Arguments4<A1, A2, A3, A4> {
|
||||
|
||||
protected final A5 arg5;
|
||||
|
||||
Arguments5(@Nullable A1 arg1, @Nullable A2 arg2, @Nullable A3 arg3, @Nullable A4 arg4,
|
||||
@Nullable A5 arg5) {
|
||||
super(arg1, arg2, arg3, arg4);
|
||||
this.arg5 = arg5;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public final A5 arg5() {
|
||||
return this.arg5;
|
||||
}
|
||||
|
||||
public final <X> X map(
|
||||
Function5<? super A1, ? super A2, ? super A3, ? super A4, ? super A5, ? extends X> mapper) {
|
||||
return mapper.apply(arg1, arg2, arg3, arg4, arg5);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,64 @@
|
|||
/*
|
||||
* Copyright (C) 2018-2022 Toshiaki Maki <makingx@gmail.com>
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.xbib.datastructures.validation.arguments;
|
||||
|
||||
import org.xbib.datastructures.validation.core.ValueValidator;
|
||||
import org.xbib.datastructures.validation.fn.Function5;
|
||||
import org.xbib.datastructures.validation.fn.Validations;
|
||||
|
||||
/**
|
||||
* Generated by https://github.com/making/yavi/blob/develop/scripts/generate-args.sh
|
||||
*
|
||||
* @since 0.7.0
|
||||
*/
|
||||
public class Arguments5Combining<A, R1, R2, R3, R4, R5> {
|
||||
protected final ValueValidator<? super A, ? extends R1> v1;
|
||||
|
||||
protected final ValueValidator<? super A, ? extends R2> v2;
|
||||
|
||||
protected final ValueValidator<? super A, ? extends R3> v3;
|
||||
|
||||
protected final ValueValidator<? super A, ? extends R4> v4;
|
||||
|
||||
protected final ValueValidator<? super A, ? extends R5> v5;
|
||||
|
||||
public Arguments5Combining(ValueValidator<? super A, ? extends R1> v1,
|
||||
ValueValidator<? super A, ? extends R2> v2,
|
||||
ValueValidator<? super A, ? extends R3> v3,
|
||||
ValueValidator<? super A, ? extends R4> v4,
|
||||
ValueValidator<? super A, ? extends R5> v5) {
|
||||
this.v1 = v1;
|
||||
this.v2 = v2;
|
||||
this.v3 = v3;
|
||||
this.v4 = v4;
|
||||
this.v5 = v5;
|
||||
}
|
||||
|
||||
public <X> Arguments1Validator<A, X> apply(
|
||||
Function5<? super R1, ? super R2, ? super R3, ? super R4, ? super R5, ? extends X> f) {
|
||||
return (a, locale, constraintContext) -> Validations.apply(f::apply,
|
||||
this.v1.validate(a, locale, constraintContext),
|
||||
this.v2.validate(a, locale, constraintContext),
|
||||
this.v3.validate(a, locale, constraintContext),
|
||||
this.v4.validate(a, locale, constraintContext),
|
||||
this.v5.validate(a, locale, constraintContext));
|
||||
}
|
||||
|
||||
public <R6> Arguments6Combining<A, R1, R2, R3, R4, R5, R6> combine(
|
||||
ValueValidator<? super A, ? extends R6> v6) {
|
||||
return new Arguments6Combining<>(v1, v2, v3, v4, v5, v6);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,64 @@
|
|||
/*
|
||||
* Copyright (C) 2018-2022 Toshiaki Maki <makingx@gmail.com>
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.xbib.datastructures.validation.arguments;
|
||||
|
||||
import org.xbib.datastructures.validation.core.ValueValidator;
|
||||
import org.xbib.datastructures.validation.fn.Function5;
|
||||
import org.xbib.datastructures.validation.fn.Validations;
|
||||
|
||||
/**
|
||||
* Generated by https://github.com/making/yavi/blob/develop/scripts/generate-args.sh
|
||||
*
|
||||
* @since 0.7.0
|
||||
*/
|
||||
public class Arguments5Splitting<A1, A2, A3, A4, A5, R1, R2, R3, R4, R5> {
|
||||
protected final ValueValidator<? super A1, ? extends R1> v1;
|
||||
|
||||
protected final ValueValidator<? super A2, ? extends R2> v2;
|
||||
|
||||
protected final ValueValidator<? super A3, ? extends R3> v3;
|
||||
|
||||
protected final ValueValidator<? super A4, ? extends R4> v4;
|
||||
|
||||
protected final ValueValidator<? super A5, ? extends R5> v5;
|
||||
|
||||
public Arguments5Splitting(ValueValidator<? super A1, ? extends R1> v1,
|
||||
ValueValidator<? super A2, ? extends R2> v2,
|
||||
ValueValidator<? super A3, ? extends R3> v3,
|
||||
ValueValidator<? super A4, ? extends R4> v4,
|
||||
ValueValidator<? super A5, ? extends R5> v5) {
|
||||
this.v1 = v1;
|
||||
this.v2 = v2;
|
||||
this.v3 = v3;
|
||||
this.v4 = v4;
|
||||
this.v5 = v5;
|
||||
}
|
||||
|
||||
public <X> Arguments5Validator<A1, A2, A3, A4, A5, X> apply(
|
||||
Function5<? super R1, ? super R2, ? super R3, ? super R4, ? super R5, ? extends X> f) {
|
||||
return (a1, a2, a3, a4, a5, locale, constraintContext) -> Validations.apply(
|
||||
f::apply, this.v1.validate(a1, locale, constraintContext),
|
||||
this.v2.validate(a2, locale, constraintContext),
|
||||
this.v3.validate(a3, locale, constraintContext),
|
||||
this.v4.validate(a4, locale, constraintContext),
|
||||
this.v5.validate(a5, locale, constraintContext));
|
||||
}
|
||||
|
||||
public <A6, R6> Arguments6Splitting<A1, A2, A3, A4, A5, A6, R1, R2, R3, R4, R5, R6> split(
|
||||
ValueValidator<? super A6, ? extends R6> v6) {
|
||||
return new Arguments6Splitting<>(v1, v2, v3, v4, v5, v6);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,124 @@
|
|||
/*
|
||||
* Copyright (C) 2018-2022 Toshiaki Maki <makingx@gmail.com>
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.xbib.datastructures.validation.arguments;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import org.xbib.datastructures.validation.core.ConstraintContext;
|
||||
import org.xbib.datastructures.validation.core.ConstraintGroup;
|
||||
import org.xbib.datastructures.validation.core.ConstraintViolationsException;
|
||||
import org.xbib.datastructures.validation.core.Validated;
|
||||
import org.xbib.datastructures.validation.core.ValueValidator;
|
||||
import org.xbib.datastructures.validation.jsr305.Nullable;
|
||||
|
||||
/**
|
||||
* Generated by https://github.com/making/yavi/blob/develop/scripts/generate-args.sh
|
||||
*
|
||||
* @since 0.3.0
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface Arguments5Validator<A1, A2, A3, A4, A5, X> {
|
||||
|
||||
Validated<X> validate(@Nullable A1 a1, @Nullable A2 a2, @Nullable A3 a3,
|
||||
@Nullable A4 a4, @Nullable A5 a5, Locale locale,
|
||||
ConstraintContext constraintContext);
|
||||
|
||||
/**
|
||||
* @since 0.7.0
|
||||
*/
|
||||
default <X2> Arguments5Validator<A1, A2, A3, A4, A5, X2> andThen(
|
||||
Function<? super X, ? extends X2> mapper) {
|
||||
return (a1, a2, a3, a4, a5, locale, constraintContext) -> Arguments5Validator.this
|
||||
.validate(a1, a2, a3, a4, a5, locale, constraintContext).map(mapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 0.11.0
|
||||
*/
|
||||
default <X2> Arguments5Validator<A1, A2, A3, A4, A5, X2> andThen(
|
||||
ValueValidator<? super X, X2> validator) {
|
||||
return (a1, a2, a3, a4, a5, locale, constraintContext) -> Arguments5Validator.this
|
||||
.validate(a1, a2, a3, a4, a5, locale, constraintContext)
|
||||
.flatMap(v -> validator.validate(v, locale, constraintContext));
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 0.7.0
|
||||
*/
|
||||
default <A> Arguments1Validator<A, X> compose(
|
||||
Function<? super A, ? extends Arguments5<? extends A1, ? extends A2, ? extends A3, ? extends A4, ? extends A5>> mapper) {
|
||||
return (a, locale, constraintContext) -> {
|
||||
final Arguments5<? extends A1, ? extends A2, ? extends A3, ? extends A4, ? extends A5> args = mapper
|
||||
.apply(a);
|
||||
return Arguments5Validator.this.validate(args.arg1(), args.arg2(),
|
||||
args.arg3(), args.arg4(), args.arg5(), locale, constraintContext);
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 0.10.0
|
||||
*/
|
||||
default Arguments5Validator<A1, A2, A3, A4, A5, Supplier<X>> lazy() {
|
||||
// WARNING:: The default implementation is not really lazy!
|
||||
return this.andThen(x -> () -> x);
|
||||
}
|
||||
|
||||
default Validated<X> validate(@Nullable A1 a1, @Nullable A2 a2, @Nullable A3 a3,
|
||||
@Nullable A4 a4, @Nullable A5 a5) {
|
||||
return this.validate(a1, a2, a3, a4, a5, Locale.getDefault(),
|
||||
ConstraintGroup.DEFAULT);
|
||||
}
|
||||
|
||||
default Validated<X> validate(@Nullable A1 a1, @Nullable A2 a2, @Nullable A3 a3,
|
||||
@Nullable A4 a4, @Nullable A5 a5, ConstraintContext constraintContext) {
|
||||
return this.validate(a1, a2, a3, a4, a5, Locale.getDefault(), constraintContext);
|
||||
}
|
||||
|
||||
default Validated<X> validate(@Nullable A1 a1, @Nullable A2 a2, @Nullable A3 a3,
|
||||
@Nullable A4 a4, @Nullable A5 a5, Locale locale) {
|
||||
return this.validate(a1, a2, a3, a4, a5, locale, ConstraintGroup.DEFAULT);
|
||||
}
|
||||
|
||||
default X validated(@Nullable A1 a1, @Nullable A2 a2, @Nullable A3 a3,
|
||||
@Nullable A4 a4, @Nullable A5 a5) throws ConstraintViolationsException {
|
||||
return this.validate(a1, a2, a3, a4, a5)
|
||||
.orElseThrow(ConstraintViolationsException::new);
|
||||
}
|
||||
|
||||
default X validated(@Nullable A1 a1, @Nullable A2 a2, @Nullable A3 a3,
|
||||
@Nullable A4 a4, @Nullable A5 a5, ConstraintContext constraintContext)
|
||||
throws ConstraintViolationsException {
|
||||
return this.validate(a1, a2, a3, a4, a5, constraintContext)
|
||||
.orElseThrow(ConstraintViolationsException::new);
|
||||
}
|
||||
|
||||
default X validated(@Nullable A1 a1, @Nullable A2 a2, @Nullable A3 a3,
|
||||
@Nullable A4 a4, @Nullable A5 a5, Locale locale)
|
||||
throws ConstraintViolationsException {
|
||||
return this.validate(a1, a2, a3, a4, a5, locale)
|
||||
.orElseThrow(ConstraintViolationsException::new);
|
||||
}
|
||||
|
||||
default X validated(@Nullable A1 a1, @Nullable A2 a2, @Nullable A3 a3,
|
||||
@Nullable A4 a4, @Nullable A5 a5, Locale locale,
|
||||
ConstraintContext constraintContext) throws ConstraintViolationsException {
|
||||
return this.validate(a1, a2, a3, a4, a5, locale, constraintContext)
|
||||
.orElseThrow(ConstraintViolationsException::new);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
/*
|
||||
* Copyright (C) 2018-2022 Toshiaki Maki <makingx@gmail.com>
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.xbib.datastructures.validation.arguments;
|
||||
|
||||
import org.xbib.datastructures.validation.fn.Function6;
|
||||
import org.xbib.datastructures.validation.jsr305.Nullable;
|
||||
|
||||
/**
|
||||
* Generated by https://github.com/making/yavi/blob/develop/scripts/generate-args.sh
|
||||
*
|
||||
* @since 0.3.0
|
||||
*/
|
||||
public class Arguments6<A1, A2, A3, A4, A5, A6> extends Arguments5<A1, A2, A3, A4, A5> {
|
||||
|
||||
protected final A6 arg6;
|
||||
|
||||
Arguments6(@Nullable A1 arg1, @Nullable A2 arg2, @Nullable A3 arg3, @Nullable A4 arg4,
|
||||
@Nullable A5 arg5, @Nullable A6 arg6) {
|
||||
super(arg1, arg2, arg3, arg4, arg5);
|
||||
this.arg6 = arg6;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public final A6 arg6() {
|
||||
return this.arg6;
|
||||
}
|
||||
|
||||
public final <X> X map(
|
||||
Function6<? super A1, ? super A2, ? super A3, ? super A4, ? super A5, ? super A6, ? extends X> mapper) {
|
||||
return mapper.apply(arg1, arg2, arg3, arg4, arg5, arg6);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,69 @@
|
|||
/*
|
||||
* Copyright (C) 2018-2022 Toshiaki Maki <makingx@gmail.com>
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.xbib.datastructures.validation.arguments;
|
||||
|
||||
import org.xbib.datastructures.validation.core.ValueValidator;
|
||||
import org.xbib.datastructures.validation.fn.Function6;
|
||||
import org.xbib.datastructures.validation.fn.Validations;
|
||||
|
||||
/**
|
||||
* Generated by https://github.com/making/yavi/blob/develop/scripts/generate-args.sh
|
||||
*
|
||||
* @since 0.7.0
|
||||
*/
|
||||
public class Arguments6Combining<A, R1, R2, R3, R4, R5, R6> {
|
||||
protected final ValueValidator<? super A, ? extends R1> v1;
|
||||
|
||||
protected final ValueValidator<? super A, ? extends R2> v2;
|
||||
|
||||
protected final ValueValidator<? super A, ? extends R3> v3;
|
||||
|
||||
protected final ValueValidator<? super A, ? extends R4> v4;
|
||||
|
||||
protected final ValueValidator<? super A, ? extends R5> v5;
|
||||
|
||||
protected final ValueValidator<? super A, ? extends R6> v6;
|
||||
|
||||
public Arguments6Combining(ValueValidator<? super A, ? extends R1> v1,
|
||||
ValueValidator<? super A, ? extends R2> v2,
|
||||
ValueValidator<? super A, ? extends R3> v3,
|
||||
ValueValidator<? super A, ? extends R4> v4,
|
||||
ValueValidator<? super A, ? extends R5> v5,
|
||||
ValueValidator<? super A, ? extends R6> v6) {
|
||||
this.v1 = v1;
|
||||
this.v2 = v2;
|
||||
this.v3 = v3;
|
||||
this.v4 = v4;
|
||||
this.v5 = v5;
|
||||
this.v6 = v6;
|
||||
}
|
||||
|
||||
public <X> Arguments1Validator<A, X> apply(
|
||||
Function6<? super R1, ? super R2, ? super R3, ? super R4, ? super R5, ? super R6, ? extends X> f) {
|
||||
return (a, locale, constraintContext) -> Validations.apply(f::apply,
|
||||
this.v1.validate(a, locale, constraintContext),
|
||||
this.v2.validate(a, locale, constraintContext),
|
||||
this.v3.validate(a, locale, constraintContext),
|
||||
this.v4.validate(a, locale, constraintContext),
|
||||
this.v5.validate(a, locale, constraintContext),
|
||||
this.v6.validate(a, locale, constraintContext));
|
||||
}
|
||||
|
||||
public <R7> Arguments7Combining<A, R1, R2, R3, R4, R5, R6, R7> combine(
|
||||
ValueValidator<? super A, ? extends R7> v7) {
|
||||
return new Arguments7Combining<>(v1, v2, v3, v4, v5, v6, v7);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,69 @@
|
|||
/*
|
||||
* Copyright (C) 2018-2022 Toshiaki Maki <makingx@gmail.com>
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.xbib.datastructures.validation.arguments;
|
||||
|
||||
import org.xbib.datastructures.validation.core.ValueValidator;
|
||||
import org.xbib.datastructures.validation.fn.Function6;
|
||||
import org.xbib.datastructures.validation.fn.Validations;
|
||||
|
||||
/**
|
||||
* Generated by https://github.com/making/yavi/blob/develop/scripts/generate-args.sh
|
||||
*
|
||||
* @since 0.7.0
|
||||
*/
|
||||
public class Arguments6Splitting<A1, A2, A3, A4, A5, A6, R1, R2, R3, R4, R5, R6> {
|
||||
protected final ValueValidator<? super A1, ? extends R1> v1;
|
||||
|
||||
protected final ValueValidator<? super A2, ? extends R2> v2;
|
||||
|
||||
protected final ValueValidator<? super A3, ? extends R3> v3;
|
||||
|
||||
protected final ValueValidator<? super A4, ? extends R4> v4;
|
||||
|
||||
protected final ValueValidator<? super A5, ? extends R5> v5;
|
||||
|
||||
protected final ValueValidator<? super A6, ? extends R6> v6;
|
||||
|
||||
public Arguments6Splitting(ValueValidator<? super A1, ? extends R1> v1,
|
||||
ValueValidator<? super A2, ? extends R2> v2,
|
||||
ValueValidator<? super A3, ? extends R3> v3,
|
||||
ValueValidator<? super A4, ? extends R4> v4,
|
||||
ValueValidator<? super A5, ? extends R5> v5,
|
||||
ValueValidator<? super A6, ? extends R6> v6) {
|
||||
this.v1 = v1;
|
||||
this.v2 = v2;
|
||||
this.v3 = v3;
|
||||
this.v4 = v4;
|
||||
this.v5 = v5;
|
||||
this.v6 = v6;
|
||||
}
|
||||
|
||||
public <X> Arguments6Validator<A1, A2, A3, A4, A5, A6, X> apply(
|
||||
Function6<? super R1, ? super R2, ? super R3, ? super R4, ? super R5, ? super R6, ? extends X> f) {
|
||||
return (a1, a2, a3, a4, a5, a6, locale, constraintContext) -> Validations.apply(
|
||||
f::apply, this.v1.validate(a1, locale, constraintContext),
|
||||
this.v2.validate(a2, locale, constraintContext),
|
||||
this.v3.validate(a3, locale, constraintContext),
|
||||
this.v4.validate(a4, locale, constraintContext),
|
||||
this.v5.validate(a5, locale, constraintContext),
|
||||
this.v6.validate(a6, locale, constraintContext));
|
||||
}
|
||||
|
||||
public <A7, R7> Arguments7Splitting<A1, A2, A3, A4, A5, A6, A7, R1, R2, R3, R4, R5, R6, R7> split(
|
||||
ValueValidator<? super A7, ? extends R7> v7) {
|
||||
return new Arguments7Splitting<>(v1, v2, v3, v4, v5, v6, v7);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,131 @@
|
|||
/*
|
||||
* Copyright (C) 2018-2022 Toshiaki Maki <makingx@gmail.com>
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.xbib.datastructures.validation.arguments;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import org.xbib.datastructures.validation.core.ConstraintContext;
|
||||
import org.xbib.datastructures.validation.core.ConstraintGroup;
|
||||
import org.xbib.datastructures.validation.core.ConstraintViolationsException;
|
||||
import org.xbib.datastructures.validation.core.Validated;
|
||||
import org.xbib.datastructures.validation.core.ValueValidator;
|
||||
import org.xbib.datastructures.validation.jsr305.Nullable;
|
||||
|
||||
/**
|
||||
* Generated by https://github.com/making/yavi/blob/develop/scripts/generate-args.sh
|
||||
*
|
||||
* @since 0.3.0
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface Arguments6Validator<A1, A2, A3, A4, A5, A6, X> {
|
||||
|
||||
Validated<X> validate(@Nullable A1 a1, @Nullable A2 a2, @Nullable A3 a3,
|
||||
@Nullable A4 a4, @Nullable A5 a5, @Nullable A6 a6, Locale locale,
|
||||
ConstraintContext constraintContext);
|
||||
|
||||
/**
|
||||
* @since 0.7.0
|
||||
*/
|
||||
default <X2> Arguments6Validator<A1, A2, A3, A4, A5, A6, X2> andThen(
|
||||
Function<? super X, ? extends X2> mapper) {
|
||||
return (a1, a2, a3, a4, a5, a6, locale,
|
||||
constraintContext) -> Arguments6Validator.this
|
||||
.validate(a1, a2, a3, a4, a5, a6, locale, constraintContext)
|
||||
.map(mapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 0.11.0
|
||||
*/
|
||||
default <X2> Arguments6Validator<A1, A2, A3, A4, A5, A6, X2> andThen(
|
||||
ValueValidator<? super X, X2> validator) {
|
||||
return (a1, a2, a3, a4, a5, a6, locale,
|
||||
constraintContext) -> Arguments6Validator.this
|
||||
.validate(a1, a2, a3, a4, a5, a6, locale, constraintContext)
|
||||
.flatMap(v -> validator.validate(v, locale, constraintContext));
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 0.7.0
|
||||
*/
|
||||
default <A> Arguments1Validator<A, X> compose(
|
||||
Function<? super A, ? extends Arguments6<? extends A1, ? extends A2, ? extends A3, ? extends A4, ? extends A5, ? extends A6>> mapper) {
|
||||
return (a, locale, constraintContext) -> {
|
||||
final Arguments6<? extends A1, ? extends A2, ? extends A3, ? extends A4, ? extends A5, ? extends A6> args = mapper
|
||||
.apply(a);
|
||||
return Arguments6Validator.this.validate(args.arg1(), args.arg2(),
|
||||
args.arg3(), args.arg4(), args.arg5(), args.arg6(), locale,
|
||||
constraintContext);
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 0.10.0
|
||||
*/
|
||||
default Arguments6Validator<A1, A2, A3, A4, A5, A6, Supplier<X>> lazy() {
|
||||
// WARNING:: The default implementation is not really lazy!
|
||||
return this.andThen(x -> () -> x);
|
||||
}
|
||||
|
||||
default Validated<X> validate(@Nullable A1 a1, @Nullable A2 a2, @Nullable A3 a3,
|
||||
@Nullable A4 a4, @Nullable A5 a5, @Nullable A6 a6) {
|
||||
return this.validate(a1, a2, a3, a4, a5, a6, Locale.getDefault(),
|
||||
ConstraintGroup.DEFAULT);
|
||||
}
|
||||
|
||||
default Validated<X> validate(@Nullable A1 a1, @Nullable A2 a2, @Nullable A3 a3,
|
||||
@Nullable A4 a4, @Nullable A5 a5, @Nullable A6 a6,
|
||||
ConstraintContext constraintContext) {
|
||||
return this.validate(a1, a2, a3, a4, a5, a6, Locale.getDefault(),
|
||||
constraintContext);
|
||||
}
|
||||
|
||||
default Validated<X> validate(@Nullable A1 a1, @Nullable A2 a2, @Nullable A3 a3,
|
||||
@Nullable A4 a4, @Nullable A5 a5, @Nullable A6 a6, Locale locale) {
|
||||
return this.validate(a1, a2, a3, a4, a5, a6, locale, ConstraintGroup.DEFAULT);
|
||||
}
|
||||
|
||||
default X validated(@Nullable A1 a1, @Nullable A2 a2, @Nullable A3 a3,
|
||||
@Nullable A4 a4, @Nullable A5 a5, @Nullable A6 a6)
|
||||
throws ConstraintViolationsException {
|
||||
return this.validate(a1, a2, a3, a4, a5, a6)
|
||||
.orElseThrow(ConstraintViolationsException::new);
|
||||
}
|
||||
|
||||
default X validated(@Nullable A1 a1, @Nullable A2 a2, @Nullable A3 a3,
|
||||
@Nullable A4 a4, @Nullable A5 a5, @Nullable A6 a6,
|
||||
ConstraintContext constraintContext) throws ConstraintViolationsException {
|
||||
return this.validate(a1, a2, a3, a4, a5, a6, constraintContext)
|
||||
.orElseThrow(ConstraintViolationsException::new);
|
||||
}
|
||||
|
||||
default X validated(@Nullable A1 a1, @Nullable A2 a2, @Nullable A3 a3,
|
||||
@Nullable A4 a4, @Nullable A5 a5, @Nullable A6 a6, Locale locale)
|
||||
throws ConstraintViolationsException {
|
||||
return this.validate(a1, a2, a3, a4, a5, a6, locale)
|
||||
.orElseThrow(ConstraintViolationsException::new);
|
||||
}
|
||||
|
||||
default X validated(@Nullable A1 a1, @Nullable A2 a2, @Nullable A3 a3,
|
||||
@Nullable A4 a4, @Nullable A5 a5, @Nullable A6 a6, Locale locale,
|
||||
ConstraintContext constraintContext) throws ConstraintViolationsException {
|
||||
return this.validate(a1, a2, a3, a4, a5, a6, locale, constraintContext)
|
||||
.orElseThrow(ConstraintViolationsException::new);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,46 @@
|
|||
/*
|
||||
* Copyright (C) 2018-2022 Toshiaki Maki <makingx@gmail.com>
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.xbib.datastructures.validation.arguments;
|
||||
|
||||
import org.xbib.datastructures.validation.fn.Function7;
|
||||
import org.xbib.datastructures.validation.jsr305.Nullable;
|
||||
|
||||
/**
|
||||
* Generated by https://github.com/making/yavi/blob/develop/scripts/generate-args.sh
|
||||
*
|
||||
* @since 0.3.0
|
||||
*/
|
||||
public class Arguments7<A1, A2, A3, A4, A5, A6, A7>
|
||||
extends Arguments6<A1, A2, A3, A4, A5, A6> {
|
||||
|
||||
protected final A7 arg7;
|
||||
|
||||
Arguments7(@Nullable A1 arg1, @Nullable A2 arg2, @Nullable A3 arg3, @Nullable A4 arg4,
|
||||
@Nullable A5 arg5, @Nullable A6 arg6, @Nullable A7 arg7) {
|
||||
super(arg1, arg2, arg3, arg4, arg5, arg6);
|
||||
this.arg7 = arg7;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public final A7 arg7() {
|
||||
return this.arg7;
|
||||
}
|
||||
|
||||
public final <X> X map(
|
||||
Function7<? super A1, ? super A2, ? super A3, ? super A4, ? super A5, ? super A6, ? super A7, ? extends X> mapper) {
|
||||
return mapper.apply(arg1, arg2, arg3, arg4, arg5, arg6, arg7);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,74 @@
|
|||
/*
|
||||
* Copyright (C) 2018-2022 Toshiaki Maki <makingx@gmail.com>
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.xbib.datastructures.validation.arguments;
|
||||
|
||||
import org.xbib.datastructures.validation.core.ValueValidator;
|
||||
import org.xbib.datastructures.validation.fn.Function7;
|
||||
import org.xbib.datastructures.validation.fn.Validations;
|
||||
|
||||
/**
|
||||
* Generated by https://github.com/making/yavi/blob/develop/scripts/generate-args.sh
|
||||
*
|
||||
* @since 0.7.0
|
||||
*/
|
||||
public class Arguments7Combining<A, R1, R2, R3, R4, R5, R6, R7> {
|
||||
protected final ValueValidator<? super A, ? extends R1> v1;
|
||||
|
||||
protected final ValueValidator<? super A, ? extends R2> v2;
|
||||
|
||||
protected final ValueValidator<? super A, ? extends R3> v3;
|
||||
|
||||
protected final ValueValidator<? super A, ? extends R4> v4;
|
||||
|
||||
protected final ValueValidator<? super A, ? extends R5> v5;
|
||||
|
||||
protected final ValueValidator<? super A, ? extends R6> v6;
|
||||
|
||||
protected final ValueValidator<? super A, ? extends R7> v7;
|
||||
|
||||
public Arguments7Combining(ValueValidator<? super A, ? extends R1> v1,
|
||||
ValueValidator<? super A, ? extends R2> v2,
|
||||
ValueValidator<? super A, ? extends R3> v3,
|
||||
ValueValidator<? super A, ? extends R4> v4,
|
||||
ValueValidator<? super A, ? extends R5> v5,
|
||||
ValueValidator<? super A, ? extends R6> v6,
|
||||
ValueValidator<? super A, ? extends R7> v7) {
|
||||
this.v1 = v1;
|
||||
this.v2 = v2;
|
||||
this.v3 = v3;
|
||||
this.v4 = v4;
|
||||
this.v5 = v5;
|
||||
this.v6 = v6;
|
||||
this.v7 = v7;
|
||||
}
|
||||
|
||||
public <X> Arguments1Validator<A, X> apply(
|
||||
Function7<? super R1, ? super R2, ? super R3, ? super R4, ? super R5, ? super R6, ? super R7, ? extends X> f) {
|
||||
return (a, locale, constraintContext) -> Validations.apply(f::apply,
|
||||
this.v1.validate(a, locale, constraintContext),
|
||||
this.v2.validate(a, locale, constraintContext),
|
||||
this.v3.validate(a, locale, constraintContext),
|
||||
this.v4.validate(a, locale, constraintContext),
|
||||
this.v5.validate(a, locale, constraintContext),
|
||||
this.v6.validate(a, locale, constraintContext),
|
||||
this.v7.validate(a, locale, constraintContext));
|
||||
}
|
||||
|
||||
public <R8> Arguments8Combining<A, R1, R2, R3, R4, R5, R6, R7, R8> combine(
|
||||
ValueValidator<? super A, ? extends R8> v8) {
|
||||
return new Arguments8Combining<>(v1, v2, v3, v4, v5, v6, v7, v8);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,74 @@
|
|||
/*
|
||||
* Copyright (C) 2018-2022 Toshiaki Maki <makingx@gmail.com>
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.xbib.datastructures.validation.arguments;
|
||||
|
||||
import org.xbib.datastructures.validation.core.ValueValidator;
|
||||
import org.xbib.datastructures.validation.fn.Function7;
|
||||
import org.xbib.datastructures.validation.fn.Validations;
|
||||
|
||||
/**
|
||||
* Generated by https://github.com/making/yavi/blob/develop/scripts/generate-args.sh
|
||||
*
|
||||
* @since 0.7.0
|
||||
*/
|
||||
public class Arguments7Splitting<A1, A2, A3, A4, A5, A6, A7, R1, R2, R3, R4, R5, R6, R7> {
|
||||
protected final ValueValidator<? super A1, ? extends R1> v1;
|
||||
|
||||
protected final ValueValidator<? super A2, ? extends R2> v2;
|
||||
|
||||
protected final ValueValidator<? super A3, ? extends R3> v3;
|
||||
|
||||
protected final ValueValidator<? super A4, ? extends R4> v4;
|
||||
|
||||
protected final ValueValidator<? super A5, ? extends R5> v5;
|
||||
|
||||
protected final ValueValidator<? super A6, ? extends R6> v6;
|
||||
|
||||
protected final ValueValidator<? super A7, ? extends R7> v7;
|
||||
|
||||
public Arguments7Splitting(ValueValidator<? super A1, ? extends R1> v1,
|
||||
ValueValidator<? super A2, ? extends R2> v2,
|
||||
ValueValidator<? super A3, ? extends R3> v3,
|
||||
ValueValidator<? super A4, ? extends R4> v4,
|
||||
ValueValidator<? super A5, ? extends R5> v5,
|
||||
ValueValidator<? super A6, ? extends R6> v6,
|
||||
ValueValidator<? super A7, ? extends R7> v7) {
|
||||
this.v1 = v1;
|
||||
this.v2 = v2;
|
||||
this.v3 = v3;
|
||||
this.v4 = v4;
|
||||
this.v5 = v5;
|
||||
this.v6 = v6;
|
||||
this.v7 = v7;
|
||||
}
|
||||
|
||||
public <X> Arguments7Validator<A1, A2, A3, A4, A5, A6, A7, X> apply(
|
||||
Function7<? super R1, ? super R2, ? super R3, ? super R4, ? super R5, ? super R6, ? super R7, ? extends X> f) {
|
||||
return (a1, a2, a3, a4, a5, a6, a7, locale, constraintContext) -> Validations
|
||||
.apply(f::apply, this.v1.validate(a1, locale, constraintContext),
|
||||
this.v2.validate(a2, locale, constraintContext),
|
||||
this.v3.validate(a3, locale, constraintContext),
|
||||
this.v4.validate(a4, locale, constraintContext),
|
||||
this.v5.validate(a5, locale, constraintContext),
|
||||
this.v6.validate(a6, locale, constraintContext),
|
||||
this.v7.validate(a7, locale, constraintContext));
|
||||
}
|
||||
|
||||
public <A8, R8> Arguments8Splitting<A1, A2, A3, A4, A5, A6, A7, A8, R1, R2, R3, R4, R5, R6, R7, R8> split(
|
||||
ValueValidator<? super A8, ? extends R8> v8) {
|
||||
return new Arguments8Splitting<>(v1, v2, v3, v4, v5, v6, v7, v8);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,133 @@
|
|||
/*
|
||||
* Copyright (C) 2018-2022 Toshiaki Maki <makingx@gmail.com>
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.xbib.datastructures.validation.arguments;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import org.xbib.datastructures.validation.core.ConstraintContext;
|
||||
import org.xbib.datastructures.validation.core.ConstraintGroup;
|
||||
import org.xbib.datastructures.validation.core.ConstraintViolationsException;
|
||||
import org.xbib.datastructures.validation.core.Validated;
|
||||
import org.xbib.datastructures.validation.core.ValueValidator;
|
||||
import org.xbib.datastructures.validation.jsr305.Nullable;
|
||||
|
||||
/**
|
||||
* Generated by https://github.com/making/yavi/blob/develop/scripts/generate-args.sh
|
||||
*
|
||||
* @since 0.3.0
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface Arguments7Validator<A1, A2, A3, A4, A5, A6, A7, X> {
|
||||
|
||||
Validated<X> validate(@Nullable A1 a1, @Nullable A2 a2, @Nullable A3 a3,
|
||||
@Nullable A4 a4, @Nullable A5 a5, @Nullable A6 a6, @Nullable A7 a7,
|
||||
Locale locale, ConstraintContext constraintContext);
|
||||
|
||||
/**
|
||||
* @since 0.7.0
|
||||
*/
|
||||
default <X2> Arguments7Validator<A1, A2, A3, A4, A5, A6, A7, X2> andThen(
|
||||
Function<? super X, ? extends X2> mapper) {
|
||||
return (a1, a2, a3, a4, a5, a6, a7, locale,
|
||||
constraintContext) -> Arguments7Validator.this
|
||||
.validate(a1, a2, a3, a4, a5, a6, a7, locale, constraintContext)
|
||||
.map(mapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 0.11.0
|
||||
*/
|
||||
default <X2> Arguments7Validator<A1, A2, A3, A4, A5, A6, A7, X2> andThen(
|
||||
ValueValidator<? super X, X2> validator) {
|
||||
return (a1, a2, a3, a4, a5, a6, a7, locale,
|
||||
constraintContext) -> Arguments7Validator.this
|
||||
.validate(a1, a2, a3, a4, a5, a6, a7, locale, constraintContext)
|
||||
.flatMap(v -> validator.validate(v, locale, constraintContext));
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 0.7.0
|
||||
*/
|
||||
default <A> Arguments1Validator<A, X> compose(
|
||||
Function<? super A, ? extends Arguments7<? extends A1, ? extends A2, ? extends A3, ? extends A4, ? extends A5, ? extends A6, ? extends A7>> mapper) {
|
||||
return (a, locale, constraintContext) -> {
|
||||
final Arguments7<? extends A1, ? extends A2, ? extends A3, ? extends A4, ? extends A5, ? extends A6, ? extends A7> args = mapper
|
||||
.apply(a);
|
||||
return Arguments7Validator.this.validate(args.arg1(), args.arg2(),
|
||||
args.arg3(), args.arg4(), args.arg5(), args.arg6(), args.arg7(),
|
||||
locale, constraintContext);
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 0.10.0
|
||||
*/
|
||||
default Arguments7Validator<A1, A2, A3, A4, A5, A6, A7, Supplier<X>> lazy() {
|
||||
// WARNING:: The default implementation is not really lazy!
|
||||
return this.andThen(x -> () -> x);
|
||||
}
|
||||
|
||||
default Validated<X> validate(@Nullable A1 a1, @Nullable A2 a2, @Nullable A3 a3,
|
||||
@Nullable A4 a4, @Nullable A5 a5, @Nullable A6 a6, @Nullable A7 a7) {
|
||||
return this.validate(a1, a2, a3, a4, a5, a6, a7, Locale.getDefault(),
|
||||
ConstraintGroup.DEFAULT);
|
||||
}
|
||||
|
||||
default Validated<X> validate(@Nullable A1 a1, @Nullable A2 a2, @Nullable A3 a3,
|
||||
@Nullable A4 a4, @Nullable A5 a5, @Nullable A6 a6, @Nullable A7 a7,
|
||||
ConstraintContext constraintContext) {
|
||||
return this.validate(a1, a2, a3, a4, a5, a6, a7, Locale.getDefault(),
|
||||
constraintContext);
|
||||
}
|
||||
|
||||
default Validated<X> validate(@Nullable A1 a1, @Nullable A2 a2, @Nullable A3 a3,
|
||||
@Nullable A4 a4, @Nullable A5 a5, @Nullable A6 a6, @Nullable A7 a7,
|
||||
Locale locale) {
|
||||
return this.validate(a1, a2, a3, a4, a5, a6, a7, locale, ConstraintGroup.DEFAULT);
|
||||
}
|
||||
|
||||
default X validated(@Nullable A1 a1, @Nullable A2 a2, @Nullable A3 a3,
|
||||
@Nullable A4 a4, @Nullable A5 a5, @Nullable A6 a6, @Nullable A7 a7)
|
||||
throws ConstraintViolationsException {
|
||||
return this.validate(a1, a2, a3, a4, a5, a6, a7)
|
||||
.orElseThrow(ConstraintViolationsException::new);
|
||||
}
|
||||
|
||||
default X validated(@Nullable A1 a1, @Nullable A2 a2, @Nullable A3 a3,
|
||||
@Nullable A4 a4, @Nullable A5 a5, @Nullable A6 a6, @Nullable A7 a7,
|
||||
ConstraintContext constraintContext) throws ConstraintViolationsException {
|
||||
return this.validate(a1, a2, a3, a4, a5, a6, a7, constraintContext)
|
||||
.orElseThrow(ConstraintViolationsException::new);
|
||||
}
|
||||
|
||||
default X validated(@Nullable A1 a1, @Nullable A2 a2, @Nullable A3 a3,
|
||||
@Nullable A4 a4, @Nullable A5 a5, @Nullable A6 a6, @Nullable A7 a7,
|
||||
Locale locale) throws ConstraintViolationsException {
|
||||
return this.validate(a1, a2, a3, a4, a5, a6, a7, locale)
|
||||
.orElseThrow(ConstraintViolationsException::new);
|
||||
}
|
||||
|
||||
default X validated(@Nullable A1 a1, @Nullable A2 a2, @Nullable A3 a3,
|
||||
@Nullable A4 a4, @Nullable A5 a5, @Nullable A6 a6, @Nullable A7 a7,
|
||||
Locale locale, ConstraintContext constraintContext)
|
||||
throws ConstraintViolationsException {
|
||||
return this.validate(a1, a2, a3, a4, a5, a6, a7, locale, constraintContext)
|
||||
.orElseThrow(ConstraintViolationsException::new);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,46 @@
|
|||
/*
|
||||
* Copyright (C) 2018-2022 Toshiaki Maki <makingx@gmail.com>
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.xbib.datastructures.validation.arguments;
|
||||
|
||||
import org.xbib.datastructures.validation.fn.Function8;
|
||||
import org.xbib.datastructures.validation.jsr305.Nullable;
|
||||
|
||||
/**
|
||||
* Generated by https://github.com/making/yavi/blob/develop/scripts/generate-args.sh
|
||||
*
|
||||
* @since 0.3.0
|
||||
*/
|
||||
public class Arguments8<A1, A2, A3, A4, A5, A6, A7, A8>
|
||||
extends Arguments7<A1, A2, A3, A4, A5, A6, A7> {
|
||||
|
||||
protected final A8 arg8;
|
||||
|
||||
Arguments8(@Nullable A1 arg1, @Nullable A2 arg2, @Nullable A3 arg3, @Nullable A4 arg4,
|
||||
@Nullable A5 arg5, @Nullable A6 arg6, @Nullable A7 arg7, @Nullable A8 arg8) {
|
||||
super(arg1, arg2, arg3, arg4, arg5, arg6, arg7);
|
||||
this.arg8 = arg8;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public final A8 arg8() {
|
||||
return this.arg8;
|
||||
}
|
||||
|
||||
public final <X> X map(
|
||||
Function8<? super A1, ? super A2, ? super A3, ? super A4, ? super A5, ? super A6, ? super A7, ? super A8, ? extends X> mapper) {
|
||||
return mapper.apply(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,79 @@
|
|||
/*
|
||||
* Copyright (C) 2018-2022 Toshiaki Maki <makingx@gmail.com>
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.xbib.datastructures.validation.arguments;
|
||||
|
||||
import org.xbib.datastructures.validation.core.ValueValidator;
|
||||
import org.xbib.datastructures.validation.fn.Function8;
|
||||
import org.xbib.datastructures.validation.fn.Validations;
|
||||
|
||||
/**
|
||||
* Generated by https://github.com/making/yavi/blob/develop/scripts/generate-args.sh
|
||||
*
|
||||
* @since 0.7.0
|
||||
*/
|
||||
public class Arguments8Combining<A, R1, R2, R3, R4, R5, R6, R7, R8> {
|
||||
protected final ValueValidator<? super A, ? extends R1> v1;
|
||||
|
||||
protected final ValueValidator<? super A, ? extends R2> v2;
|
||||
|
||||
protected final ValueValidator<? super A, ? extends R3> v3;
|
||||
|
||||
protected final ValueValidator<? super A, ? extends R4> v4;
|
||||
|
||||
protected final ValueValidator<? super A, ? extends R5> v5;
|
||||
|
||||
protected final ValueValidator<? super A, ? extends R6> v6;
|
||||
|
||||
protected final ValueValidator<? super A, ? extends R7> v7;
|
||||
|
||||
protected final ValueValidator<? super A, ? extends R8> v8;
|
||||
|
||||
public Arguments8Combining(ValueValidator<? super A, ? extends R1> v1,
|
||||
ValueValidator<? super A, ? extends R2> v2,
|
||||
ValueValidator<? super A, ? extends R3> v3,
|
||||
ValueValidator<? super A, ? extends R4> v4,
|
||||
ValueValidator<? super A, ? extends R5> v5,
|
||||
ValueValidator<? super A, ? extends R6> v6,
|
||||
ValueValidator<? super A, ? extends R7> v7,
|
||||
ValueValidator<? super A, ? extends R8> v8) {
|
||||
this.v1 = v1;
|
||||
this.v2 = v2;
|
||||
this.v3 = v3;
|
||||
this.v4 = v4;
|
||||
this.v5 = v5;
|
||||
this.v6 = v6;
|
||||
this.v7 = v7;
|
||||
this.v8 = v8;
|
||||
}
|
||||
|
||||
public <X> Arguments1Validator<A, X> apply(
|
||||
Function8<? super R1, ? super R2, ? super R3, ? super R4, ? super R5, ? super R6, ? super R7, ? super R8, ? extends X> f) {
|
||||
return (a, locale, constraintContext) -> Validations.apply(f::apply,
|
||||
this.v1.validate(a, locale, constraintContext),
|
||||
this.v2.validate(a, locale, constraintContext),
|
||||
this.v3.validate(a, locale, constraintContext),
|
||||
this.v4.validate(a, locale, constraintContext),
|
||||
this.v5.validate(a, locale, constraintContext),
|
||||
this.v6.validate(a, locale, constraintContext),
|
||||
this.v7.validate(a, locale, constraintContext),
|
||||
this.v8.validate(a, locale, constraintContext));
|
||||
}
|
||||
|
||||
public <R9> Arguments9Combining<A, R1, R2, R3, R4, R5, R6, R7, R8, R9> combine(
|
||||
ValueValidator<? super A, ? extends R9> v9) {
|
||||
return new Arguments9Combining<>(v1, v2, v3, v4, v5, v6, v7, v8, v9);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,79 @@
|
|||
/*
|
||||
* Copyright (C) 2018-2022 Toshiaki Maki <makingx@gmail.com>
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.xbib.datastructures.validation.arguments;
|
||||
|
||||
import org.xbib.datastructures.validation.core.ValueValidator;
|
||||
import org.xbib.datastructures.validation.fn.Function8;
|
||||
import org.xbib.datastructures.validation.fn.Validations;
|
||||
|
||||
/**
|
||||
* Generated by https://github.com/making/yavi/blob/develop/scripts/generate-args.sh
|
||||
*
|
||||
* @since 0.7.0
|
||||
*/
|
||||
public class Arguments8Splitting<A1, A2, A3, A4, A5, A6, A7, A8, R1, R2, R3, R4, R5, R6, R7, R8> {
|
||||
protected final ValueValidator<? super A1, ? extends R1> v1;
|
||||
|
||||
protected final ValueValidator<? super A2, ? extends R2> v2;
|
||||
|
||||
protected final ValueValidator<? super A3, ? extends R3> v3;
|
||||
|
||||
protected final ValueValidator<? super A4, ? extends R4> v4;
|
||||
|
||||
protected final ValueValidator<? super A5, ? extends R5> v5;
|
||||
|
||||
protected final ValueValidator<? super A6, ? extends R6> v6;
|
||||
|
||||
protected final ValueValidator<? super A7, ? extends R7> v7;
|
||||
|
||||
protected final ValueValidator<? super A8, ? extends R8> v8;
|
||||
|
||||
public Arguments8Splitting(ValueValidator<? super A1, ? extends R1> v1,
|
||||
ValueValidator<? super A2, ? extends R2> v2,
|
||||
ValueValidator<? super A3, ? extends R3> v3,
|
||||
ValueValidator<? super A4, ? extends R4> v4,
|
||||
ValueValidator<? super A5, ? extends R5> v5,
|
||||
ValueValidator<? super A6, ? extends R6> v6,
|
||||
ValueValidator<? super A7, ? extends R7> v7,
|
||||
ValueValidator<? super A8, ? extends R8> v8) {
|
||||
this.v1 = v1;
|
||||
this.v2 = v2;
|
||||
this.v3 = v3;
|
||||
this.v4 = v4;
|
||||
this.v5 = v5;
|
||||
this.v6 = v6;
|
||||
this.v7 = v7;
|
||||
this.v8 = v8;
|
||||
}
|
||||
|
||||
public <X> Arguments8Validator<A1, A2, A3, A4, A5, A6, A7, A8, X> apply(
|
||||
Function8<? super R1, ? super R2, ? super R3, ? super R4, ? super R5, ? super R6, ? super R7, ? super R8, ? extends X> f) {
|
||||
return (a1, a2, a3, a4, a5, a6, a7, a8, locale, constraintContext) -> Validations
|
||||
.apply(f::apply, this.v1.validate(a1, locale, constraintContext),
|
||||
this.v2.validate(a2, locale, constraintContext),
|
||||
this.v3.validate(a3, locale, constraintContext),
|
||||
this.v4.validate(a4, locale, constraintContext),
|
||||
this.v5.validate(a5, locale, constraintContext),
|
||||
this.v6.validate(a6, locale, constraintContext),
|
||||
this.v7.validate(a7, locale, constraintContext),
|
||||
this.v8.validate(a8, locale, constraintContext));
|
||||
}
|
||||
|
||||
public <A9, R9> Arguments9Splitting<A1, A2, A3, A4, A5, A6, A7, A8, A9, R1, R2, R3, R4, R5, R6, R7, R8, R9> split(
|
||||
ValueValidator<? super A9, ? extends R9> v9) {
|
||||
return new Arguments9Splitting<>(v1, v2, v3, v4, v5, v6, v7, v8, v9);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,136 @@
|
|||
/*
|
||||
* Copyright (C) 2018-2022 Toshiaki Maki <makingx@gmail.com>
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.xbib.datastructures.validation.arguments;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import org.xbib.datastructures.validation.core.ConstraintContext;
|
||||
import org.xbib.datastructures.validation.core.ConstraintGroup;
|
||||
import org.xbib.datastructures.validation.core.ConstraintViolationsException;
|
||||
import org.xbib.datastructures.validation.core.Validated;
|
||||
import org.xbib.datastructures.validation.core.ValueValidator;
|
||||
import org.xbib.datastructures.validation.jsr305.Nullable;
|
||||
|
||||
/**
|
||||
* Generated by https://github.com/making/yavi/blob/develop/scripts/generate-args.sh
|
||||
*
|
||||
* @since 0.3.0
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface Arguments8Validator<A1, A2, A3, A4, A5, A6, A7, A8, X> {
|
||||
|
||||
Validated<X> validate(@Nullable A1 a1, @Nullable A2 a2, @Nullable A3 a3,
|
||||
@Nullable A4 a4, @Nullable A5 a5, @Nullable A6 a6, @Nullable A7 a7,
|
||||
@Nullable A8 a8, Locale locale, ConstraintContext constraintContext);
|
||||
|
||||
/**
|
||||
* @since 0.7.0
|
||||
*/
|
||||
default <X2> Arguments8Validator<A1, A2, A3, A4, A5, A6, A7, A8, X2> andThen(
|
||||
Function<? super X, ? extends X2> mapper) {
|
||||
return (a1, a2, a3, a4, a5, a6, a7, a8, locale,
|
||||
constraintContext) -> Arguments8Validator.this.validate(a1, a2, a3, a4,
|
||||
a5, a6, a7, a8, locale, constraintContext).map(mapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 0.11.0
|
||||
*/
|
||||
default <X2> Arguments8Validator<A1, A2, A3, A4, A5, A6, A7, A8, X2> andThen(
|
||||
ValueValidator<? super X, X2> validator) {
|
||||
return (a1, a2, a3, a4, a5, a6, a7, a8, locale,
|
||||
constraintContext) -> Arguments8Validator.this
|
||||
.validate(a1, a2, a3, a4, a5, a6, a7, a8, locale,
|
||||
constraintContext)
|
||||
.flatMap(v -> validator.validate(v, locale, constraintContext));
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 0.7.0
|
||||
*/
|
||||
default <A> Arguments1Validator<A, X> compose(
|
||||
Function<? super A, ? extends Arguments8<? extends A1, ? extends A2, ? extends A3, ? extends A4, ? extends A5, ? extends A6, ? extends A7, ? extends A8>> mapper) {
|
||||
return (a, locale, constraintContext) -> {
|
||||
final Arguments8<? extends A1, ? extends A2, ? extends A3, ? extends A4, ? extends A5, ? extends A6, ? extends A7, ? extends A8> args = mapper
|
||||
.apply(a);
|
||||
return Arguments8Validator.this.validate(args.arg1(), args.arg2(),
|
||||
args.arg3(), args.arg4(), args.arg5(), args.arg6(), args.arg7(),
|
||||
args.arg8(), locale, constraintContext);
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 0.10.0
|
||||
*/
|
||||
default Arguments8Validator<A1, A2, A3, A4, A5, A6, A7, A8, Supplier<X>> lazy() {
|
||||
// WARNING:: The default implementation is not really lazy!
|
||||
return this.andThen(x -> () -> x);
|
||||
}
|
||||
|
||||
default Validated<X> validate(@Nullable A1 a1, @Nullable A2 a2, @Nullable A3 a3,
|
||||
@Nullable A4 a4, @Nullable A5 a5, @Nullable A6 a6, @Nullable A7 a7,
|
||||
@Nullable A8 a8) {
|
||||
return this.validate(a1, a2, a3, a4, a5, a6, a7, a8, Locale.getDefault(),
|
||||
ConstraintGroup.DEFAULT);
|
||||
}
|
||||
|
||||
default Validated<X> validate(@Nullable A1 a1, @Nullable A2 a2, @Nullable A3 a3,
|
||||
@Nullable A4 a4, @Nullable A5 a5, @Nullable A6 a6, @Nullable A7 a7,
|
||||
@Nullable A8 a8, ConstraintContext constraintContext) {
|
||||
return this.validate(a1, a2, a3, a4, a5, a6, a7, a8, Locale.getDefault(),
|
||||
constraintContext);
|
||||
}
|
||||
|
||||
default Validated<X> validate(@Nullable A1 a1, @Nullable A2 a2, @Nullable A3 a3,
|
||||
@Nullable A4 a4, @Nullable A5 a5, @Nullable A6 a6, @Nullable A7 a7,
|
||||
@Nullable A8 a8, Locale locale) {
|
||||
return this.validate(a1, a2, a3, a4, a5, a6, a7, a8, locale,
|
||||
ConstraintGroup.DEFAULT);
|
||||
}
|
||||
|
||||
default X validated(@Nullable A1 a1, @Nullable A2 a2, @Nullable A3 a3,
|
||||
@Nullable A4 a4, @Nullable A5 a5, @Nullable A6 a6, @Nullable A7 a7,
|
||||
@Nullable A8 a8) throws ConstraintViolationsException {
|
||||
return this.validate(a1, a2, a3, a4, a5, a6, a7, a8)
|
||||
.orElseThrow(ConstraintViolationsException::new);
|
||||
}
|
||||
|
||||
default X validated(@Nullable A1 a1, @Nullable A2 a2, @Nullable A3 a3,
|
||||
@Nullable A4 a4, @Nullable A5 a5, @Nullable A6 a6, @Nullable A7 a7,
|
||||
@Nullable A8 a8, ConstraintContext constraintContext)
|
||||
throws ConstraintViolationsException {
|
||||
return this.validate(a1, a2, a3, a4, a5, a6, a7, a8, constraintContext)
|
||||
.orElseThrow(ConstraintViolationsException::new);
|
||||
}
|
||||
|
||||
default X validated(@Nullable A1 a1, @Nullable A2 a2, @Nullable A3 a3,
|
||||
@Nullable A4 a4, @Nullable A5 a5, @Nullable A6 a6, @Nullable A7 a7,
|
||||
@Nullable A8 a8, Locale locale) throws ConstraintViolationsException {
|
||||
return this.validate(a1, a2, a3, a4, a5, a6, a7, a8, locale)
|
||||
.orElseThrow(ConstraintViolationsException::new);
|
||||
}
|
||||
|
||||
default X validated(@Nullable A1 a1, @Nullable A2 a2, @Nullable A3 a3,
|
||||
@Nullable A4 a4, @Nullable A5 a5, @Nullable A6 a6, @Nullable A7 a7,
|
||||
@Nullable A8 a8, Locale locale, ConstraintContext constraintContext)
|
||||
throws ConstraintViolationsException {
|
||||
return this.validate(a1, a2, a3, a4, a5, a6, a7, a8, locale, constraintContext)
|
||||
.orElseThrow(ConstraintViolationsException::new);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,47 @@
|
|||
/*
|
||||
* Copyright (C) 2018-2022 Toshiaki Maki <makingx@gmail.com>
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.xbib.datastructures.validation.arguments;
|
||||
|
||||
import org.xbib.datastructures.validation.fn.Function9;
|
||||
import org.xbib.datastructures.validation.jsr305.Nullable;
|
||||
|
||||
/**
|
||||
* Generated by https://github.com/making/yavi/blob/develop/scripts/generate-args.sh
|
||||
*
|
||||
* @since 0.3.0
|
||||
*/
|
||||
public class Arguments9<A1, A2, A3, A4, A5, A6, A7, A8, A9>
|
||||
extends Arguments8<A1, A2, A3, A4, A5, A6, A7, A8> {
|
||||
|
||||
protected final A9 arg9;
|
||||
|
||||
Arguments9(@Nullable A1 arg1, @Nullable A2 arg2, @Nullable A3 arg3, @Nullable A4 arg4,
|
||||
@Nullable A5 arg5, @Nullable A6 arg6, @Nullable A7 arg7, @Nullable A8 arg8,
|
||||
@Nullable A9 arg9) {
|
||||
super(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8);
|
||||
this.arg9 = arg9;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public final A9 arg9() {
|
||||
return this.arg9;
|
||||
}
|
||||
|
||||
public final <X> X map(
|
||||
Function9<? super A1, ? super A2, ? super A3, ? super A4, ? super A5, ? super A6, ? super A7, ? super A8, ? super A9, ? extends X> mapper) {
|
||||
return mapper.apply(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,84 @@
|
|||
/*
|
||||
* Copyright (C) 2018-2022 Toshiaki Maki <makingx@gmail.com>
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.xbib.datastructures.validation.arguments;
|
||||
|
||||
import org.xbib.datastructures.validation.core.ValueValidator;
|
||||
import org.xbib.datastructures.validation.fn.Function9;
|
||||
import org.xbib.datastructures.validation.fn.Validations;
|
||||
|
||||
/**
|
||||
* Generated by https://github.com/making/yavi/blob/develop/scripts/generate-args.sh
|
||||
*
|
||||
* @since 0.7.0
|
||||
*/
|
||||
public class Arguments9Combining<A, R1, R2, R3, R4, R5, R6, R7, R8, R9> {
|
||||
protected final ValueValidator<? super A, ? extends R1> v1;
|
||||
|
||||
protected final ValueValidator<? super A, ? extends R2> v2;
|
||||
|
||||
protected final ValueValidator<? super A, ? extends R3> v3;
|
||||
|
||||
protected final ValueValidator<? super A, ? extends R4> v4;
|
||||
|
||||
protected final ValueValidator<? super A, ? extends R5> v5;
|
||||
|
||||
protected final ValueValidator<? super A, ? extends R6> v6;
|
||||
|
||||
protected final ValueValidator<? super A, ? extends R7> v7;
|
||||
|
||||
protected final ValueValidator<? super A, ? extends R8> v8;
|
||||
|
||||
protected final ValueValidator<? super A, ? extends R9> v9;
|
||||
|
||||
public Arguments9Combining(ValueValidator<? super A, ? extends R1> v1,
|
||||
ValueValidator<? super A, ? extends R2> v2,
|
||||
ValueValidator<? super A, ? extends R3> v3,
|
||||
ValueValidator<? super A, ? extends R4> v4,
|
||||
ValueValidator<? super A, ? extends R5> v5,
|
||||
ValueValidator<? super A, ? extends R6> v6,
|
||||
ValueValidator<? super A, ? extends R7> v7,
|
||||
ValueValidator<? super A, ? extends R8> v8,
|
||||
ValueValidator<? super A, ? extends R9> v9) {
|
||||
this.v1 = v1;
|
||||
this.v2 = v2;
|
||||
this.v3 = v3;
|
||||
this.v4 = v4;
|
||||
this.v5 = v5;
|
||||
this.v6 = v6;
|
||||
this.v7 = v7;
|
||||
this.v8 = v8;
|
||||
this.v9 = v9;
|
||||
}
|
||||
|
||||
public <X> Arguments1Validator<A, X> apply(
|
||||
Function9<? super R1, ? super R2, ? super R3, ? super R4, ? super R5, ? super R6, ? super R7, ? super R8, ? super R9, ? extends X> f) {
|
||||
return (a, locale, constraintContext) -> Validations.apply(f::apply,
|
||||
this.v1.validate(a, locale, constraintContext),
|
||||
this.v2.validate(a, locale, constraintContext),
|
||||
this.v3.validate(a, locale, constraintContext),
|
||||
this.v4.validate(a, locale, constraintContext),
|
||||
this.v5.validate(a, locale, constraintContext),
|
||||
this.v6.validate(a, locale, constraintContext),
|
||||
this.v7.validate(a, locale, constraintContext),
|
||||
this.v8.validate(a, locale, constraintContext),
|
||||
this.v9.validate(a, locale, constraintContext));
|
||||
}
|
||||
|
||||
public <R10> Arguments10Combining<A, R1, R2, R3, R4, R5, R6, R7, R8, R9, R10> combine(
|
||||
ValueValidator<? super A, ? extends R10> v10) {
|
||||
return new Arguments10Combining<>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,85 @@
|
|||
/*
|
||||
* Copyright (C) 2018-2022 Toshiaki Maki <makingx@gmail.com>
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.xbib.datastructures.validation.arguments;
|
||||
|
||||
import org.xbib.datastructures.validation.core.ValueValidator;
|
||||
import org.xbib.datastructures.validation.fn.Function9;
|
||||
import org.xbib.datastructures.validation.fn.Validations;
|
||||
|
||||
/**
|
||||
* Generated by https://github.com/making/yavi/blob/develop/scripts/generate-args.sh
|
||||
*
|
||||
* @since 0.7.0
|
||||
*/
|
||||
public class Arguments9Splitting<A1, A2, A3, A4, A5, A6, A7, A8, A9, R1, R2, R3, R4, R5, R6, R7, R8, R9> {
|
||||
protected final ValueValidator<? super A1, ? extends R1> v1;
|
||||
|
||||
protected final ValueValidator<? super A2, ? extends R2> v2;
|
||||
|
||||
protected final ValueValidator<? super A3, ? extends R3> v3;
|
||||
|
||||
protected final ValueValidator<? super A4, ? extends R4> v4;
|
||||
|
||||
protected final ValueValidator<? super A5, ? extends R5> v5;
|
||||
|
||||
protected final ValueValidator<? super A6, ? extends R6> v6;
|
||||
|
||||
protected final ValueValidator<? super A7, ? extends R7> v7;
|
||||
|
||||
protected final ValueValidator<? super A8, ? extends R8> v8;
|
||||
|
||||
protected final ValueValidator<? super A9, ? extends R9> v9;
|
||||
|
||||
public Arguments9Splitting(ValueValidator<? super A1, ? extends R1> v1,
|
||||
ValueValidator<? super A2, ? extends R2> v2,
|
||||
ValueValidator<? super A3, ? extends R3> v3,
|
||||
ValueValidator<? super A4, ? extends R4> v4,
|
||||
ValueValidator<? super A5, ? extends R5> v5,
|
||||
ValueValidator<? super A6, ? extends R6> v6,
|
||||
ValueValidator<? super A7, ? extends R7> v7,
|
||||
ValueValidator<? super A8, ? extends R8> v8,
|
||||
ValueValidator<? super A9, ? extends R9> v9) {
|
||||
this.v1 = v1;
|
||||
this.v2 = v2;
|
||||
this.v3 = v3;
|
||||
this.v4 = v4;
|
||||
this.v5 = v5;
|
||||
this.v6 = v6;
|
||||
this.v7 = v7;
|
||||
this.v8 = v8;
|
||||
this.v9 = v9;
|
||||
}
|
||||
|
||||
public <X> Arguments9Validator<A1, A2, A3, A4, A5, A6, A7, A8, A9, X> apply(
|
||||
Function9<? super R1, ? super R2, ? super R3, ? super R4, ? super R5, ? super R6, ? super R7, ? super R8, ? super R9, ? extends X> f) {
|
||||
return (a1, a2, a3, a4, a5, a6, a7, a8, a9, locale,
|
||||
constraintContext) -> Validations.apply(f::apply,
|
||||
this.v1.validate(a1, locale, constraintContext),
|
||||
this.v2.validate(a2, locale, constraintContext),
|
||||
this.v3.validate(a3, locale, constraintContext),
|
||||
this.v4.validate(a4, locale, constraintContext),
|
||||
this.v5.validate(a5, locale, constraintContext),
|
||||
this.v6.validate(a6, locale, constraintContext),
|
||||
this.v7.validate(a7, locale, constraintContext),
|
||||
this.v8.validate(a8, locale, constraintContext),
|
||||
this.v9.validate(a9, locale, constraintContext));
|
||||
}
|
||||
|
||||
public <A10, R10> Arguments10Splitting<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, R1, R2, R3, R4, R5, R6, R7, R8, R9, R10> split(
|
||||
ValueValidator<? super A10, ? extends R10> v10) {
|
||||
return new Arguments10Splitting<>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,139 @@
|
|||
/*
|
||||
* Copyright (C) 2018-2022 Toshiaki Maki <makingx@gmail.com>
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.xbib.datastructures.validation.arguments;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import org.xbib.datastructures.validation.core.ConstraintContext;
|
||||
import org.xbib.datastructures.validation.core.ConstraintGroup;
|
||||
import org.xbib.datastructures.validation.core.ConstraintViolationsException;
|
||||
import org.xbib.datastructures.validation.core.Validated;
|
||||
import org.xbib.datastructures.validation.core.ValueValidator;
|
||||
import org.xbib.datastructures.validation.jsr305.Nullable;
|
||||
|
||||
/**
|
||||
* Generated by https://github.com/making/yavi/blob/develop/scripts/generate-args.sh
|
||||
*
|
||||
* @since 0.3.0
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface Arguments9Validator<A1, A2, A3, A4, A5, A6, A7, A8, A9, X> {
|
||||
|
||||
Validated<X> validate(@Nullable A1 a1, @Nullable A2 a2, @Nullable A3 a3,
|
||||
@Nullable A4 a4, @Nullable A5 a5, @Nullable A6 a6, @Nullable A7 a7,
|
||||
@Nullable A8 a8, @Nullable A9 a9, Locale locale,
|
||||
ConstraintContext constraintContext);
|
||||
|
||||
/**
|
||||
* @since 0.7.0
|
||||
*/
|
||||
default <X2> Arguments9Validator<A1, A2, A3, A4, A5, A6, A7, A8, A9, X2> andThen(
|
||||
Function<? super X, ? extends X2> mapper) {
|
||||
return (a1, a2, a3, a4, a5, a6, a7, a8, a9, locale,
|
||||
constraintContext) -> Arguments9Validator.this.validate(a1, a2, a3, a4,
|
||||
a5, a6, a7, a8, a9, locale, constraintContext).map(mapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 0.11.0
|
||||
*/
|
||||
default <X2> Arguments9Validator<A1, A2, A3, A4, A5, A6, A7, A8, A9, X2> andThen(
|
||||
ValueValidator<? super X, X2> validator) {
|
||||
return (a1, a2, a3, a4, a5, a6, a7, a8, a9, locale,
|
||||
constraintContext) -> Arguments9Validator.this
|
||||
.validate(a1, a2, a3, a4, a5, a6, a7, a8, a9, locale,
|
||||
constraintContext)
|
||||
.flatMap(v -> validator.validate(v, locale, constraintContext));
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 0.7.0
|
||||
*/
|
||||
default <A> Arguments1Validator<A, X> compose(
|
||||
Function<? super A, ? extends Arguments9<? extends A1, ? extends A2, ? extends A3, ? extends A4, ? extends A5, ? extends A6, ? extends A7, ? extends A8, ? extends A9>> mapper) {
|
||||
return (a, locale, constraintContext) -> {
|
||||
final Arguments9<? extends A1, ? extends A2, ? extends A3, ? extends A4, ? extends A5, ? extends A6, ? extends A7, ? extends A8, ? extends A9> args = mapper
|
||||
.apply(a);
|
||||
return Arguments9Validator.this.validate(args.arg1(), args.arg2(),
|
||||
args.arg3(), args.arg4(), args.arg5(), args.arg6(), args.arg7(),
|
||||
args.arg8(), args.arg9(), locale, constraintContext);
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 0.10.0
|
||||
*/
|
||||
default Arguments9Validator<A1, A2, A3, A4, A5, A6, A7, A8, A9, Supplier<X>> lazy() {
|
||||
// WARNING:: The default implementation is not really lazy!
|
||||
return this.andThen(x -> () -> x);
|
||||
}
|
||||
|
||||
default Validated<X> validate(@Nullable A1 a1, @Nullable A2 a2, @Nullable A3 a3,
|
||||
@Nullable A4 a4, @Nullable A5 a5, @Nullable A6 a6, @Nullable A7 a7,
|
||||
@Nullable A8 a8, @Nullable A9 a9) {
|
||||
return this.validate(a1, a2, a3, a4, a5, a6, a7, a8, a9, Locale.getDefault(),
|
||||
ConstraintGroup.DEFAULT);
|
||||
}
|
||||
|
||||
default Validated<X> validate(@Nullable A1 a1, @Nullable A2 a2, @Nullable A3 a3,
|
||||
@Nullable A4 a4, @Nullable A5 a5, @Nullable A6 a6, @Nullable A7 a7,
|
||||
@Nullable A8 a8, @Nullable A9 a9, ConstraintContext constraintContext) {
|
||||
return this.validate(a1, a2, a3, a4, a5, a6, a7, a8, a9, Locale.getDefault(),
|
||||
constraintContext);
|
||||
}
|
||||
|
||||
default Validated<X> validate(@Nullable A1 a1, @Nullable A2 a2, @Nullable A3 a3,
|
||||
@Nullable A4 a4, @Nullable A5 a5, @Nullable A6 a6, @Nullable A7 a7,
|
||||
@Nullable A8 a8, @Nullable A9 a9, Locale locale) {
|
||||
return this.validate(a1, a2, a3, a4, a5, a6, a7, a8, a9, locale,
|
||||
ConstraintGroup.DEFAULT);
|
||||
}
|
||||
|
||||
default X validated(@Nullable A1 a1, @Nullable A2 a2, @Nullable A3 a3,
|
||||
@Nullable A4 a4, @Nullable A5 a5, @Nullable A6 a6, @Nullable A7 a7,
|
||||
@Nullable A8 a8, @Nullable A9 a9) throws ConstraintViolationsException {
|
||||
return this.validate(a1, a2, a3, a4, a5, a6, a7, a8, a9)
|
||||
.orElseThrow(ConstraintViolationsException::new);
|
||||
}
|
||||
|
||||
default X validated(@Nullable A1 a1, @Nullable A2 a2, @Nullable A3 a3,
|
||||
@Nullable A4 a4, @Nullable A5 a5, @Nullable A6 a6, @Nullable A7 a7,
|
||||
@Nullable A8 a8, @Nullable A9 a9, ConstraintContext constraintContext)
|
||||
throws ConstraintViolationsException {
|
||||
return this.validate(a1, a2, a3, a4, a5, a6, a7, a8, a9, constraintContext)
|
||||
.orElseThrow(ConstraintViolationsException::new);
|
||||
}
|
||||
|
||||
default X validated(@Nullable A1 a1, @Nullable A2 a2, @Nullable A3 a3,
|
||||
@Nullable A4 a4, @Nullable A5 a5, @Nullable A6 a6, @Nullable A7 a7,
|
||||
@Nullable A8 a8, @Nullable A9 a9, Locale locale)
|
||||
throws ConstraintViolationsException {
|
||||
return this.validate(a1, a2, a3, a4, a5, a6, a7, a8, a9, locale)
|
||||
.orElseThrow(ConstraintViolationsException::new);
|
||||
}
|
||||
|
||||
default X validated(@Nullable A1 a1, @Nullable A2 a2, @Nullable A3 a3,
|
||||
@Nullable A4 a4, @Nullable A5 a5, @Nullable A6 a6, @Nullable A7 a7,
|
||||
@Nullable A8 a8, @Nullable A9 a9, Locale locale,
|
||||
ConstraintContext constraintContext) throws ConstraintViolationsException {
|
||||
return this
|
||||
.validate(a1, a2, a3, a4, a5, a6, a7, a8, a9, locale, constraintContext)
|
||||
.orElseThrow(ConstraintViolationsException::new);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,686 @@
|
|||
/*
|
||||
* Copyright (C) 2018-2022 Toshiaki Maki <makingx@gmail.com>
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.xbib.datastructures.validation.arguments;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import org.xbib.datastructures.validation.core.Validated;
|
||||
import org.xbib.datastructures.validation.core.ValueValidator;
|
||||
|
||||
import static java.util.function.Function.identity;
|
||||
|
||||
/**
|
||||
* Generated by https://github.com/making/yavi/blob/develop/scripts/generate-args.sh
|
||||
*
|
||||
* @since 0.7.0
|
||||
*/
|
||||
public class ArgumentsValidators {
|
||||
|
||||
public static <A1, A2, R1, R2> Arguments2Splitting<A1, A2, R1, R2> split(
|
||||
ValueValidator<? super A1, ? extends R1> v1,
|
||||
ValueValidator<? super A2, ? extends R2> v2) {
|
||||
return new Arguments2Splitting<>(v1, v2);
|
||||
}
|
||||
|
||||
public static <A1, A2, A3, R1, R2, R3> Arguments3Splitting<A1, A2, A3, R1, R2, R3> split(
|
||||
ValueValidator<? super A1, ? extends R1> v1,
|
||||
ValueValidator<? super A2, ? extends R2> v2,
|
||||
ValueValidator<? super A3, ? extends R3> v3) {
|
||||
return new Arguments3Splitting<>(v1, v2, v3);
|
||||
}
|
||||
|
||||
public static <A1, A2, A3, A4, R1, R2, R3, R4> Arguments4Splitting<A1, A2, A3, A4, R1, R2, R3, R4> split(
|
||||
ValueValidator<? super A1, ? extends R1> v1,
|
||||
ValueValidator<? super A2, ? extends R2> v2,
|
||||
ValueValidator<? super A3, ? extends R3> v3,
|
||||
ValueValidator<? super A4, ? extends R4> v4) {
|
||||
return new Arguments4Splitting<>(v1, v2, v3, v4);
|
||||
}
|
||||
|
||||
public static <A1, A2, A3, A4, A5, R1, R2, R3, R4, R5> Arguments5Splitting<A1, A2, A3, A4, A5, R1, R2, R3, R4, R5> split(
|
||||
ValueValidator<? super A1, ? extends R1> v1,
|
||||
ValueValidator<? super A2, ? extends R2> v2,
|
||||
ValueValidator<? super A3, ? extends R3> v3,
|
||||
ValueValidator<? super A4, ? extends R4> v4,
|
||||
ValueValidator<? super A5, ? extends R5> v5) {
|
||||
return new Arguments5Splitting<>(v1, v2, v3, v4, v5);
|
||||
}
|
||||
|
||||
public static <A1, A2, A3, A4, A5, A6, R1, R2, R3, R4, R5, R6> Arguments6Splitting<A1, A2, A3, A4, A5, A6, R1, R2, R3, R4, R5, R6> split(
|
||||
ValueValidator<? super A1, ? extends R1> v1,
|
||||
ValueValidator<? super A2, ? extends R2> v2,
|
||||
ValueValidator<? super A3, ? extends R3> v3,
|
||||
ValueValidator<? super A4, ? extends R4> v4,
|
||||
ValueValidator<? super A5, ? extends R5> v5,
|
||||
ValueValidator<? super A6, ? extends R6> v6) {
|
||||
return new Arguments6Splitting<>(v1, v2, v3, v4, v5, v6);
|
||||
}
|
||||
|
||||
public static <A1, A2, A3, A4, A5, A6, A7, R1, R2, R3, R4, R5, R6, R7> Arguments7Splitting<A1, A2, A3, A4, A5, A6, A7, R1, R2, R3, R4, R5, R6, R7> split(
|
||||
ValueValidator<? super A1, ? extends R1> v1,
|
||||
ValueValidator<? super A2, ? extends R2> v2,
|
||||
ValueValidator<? super A3, ? extends R3> v3,
|
||||
ValueValidator<? super A4, ? extends R4> v4,
|
||||
ValueValidator<? super A5, ? extends R5> v5,
|
||||
ValueValidator<? super A6, ? extends R6> v6,
|
||||
ValueValidator<? super A7, ? extends R7> v7) {
|
||||
return new Arguments7Splitting<>(v1, v2, v3, v4, v5, v6, v7);
|
||||
}
|
||||
|
||||
public static <A1, A2, A3, A4, A5, A6, A7, A8, R1, R2, R3, R4, R5, R6, R7, R8> Arguments8Splitting<A1, A2, A3, A4, A5, A6, A7, A8, R1, R2, R3, R4, R5, R6, R7, R8> split(
|
||||
ValueValidator<? super A1, ? extends R1> v1,
|
||||
ValueValidator<? super A2, ? extends R2> v2,
|
||||
ValueValidator<? super A3, ? extends R3> v3,
|
||||
ValueValidator<? super A4, ? extends R4> v4,
|
||||
ValueValidator<? super A5, ? extends R5> v5,
|
||||
ValueValidator<? super A6, ? extends R6> v6,
|
||||
ValueValidator<? super A7, ? extends R7> v7,
|
||||
ValueValidator<? super A8, ? extends R8> v8) {
|
||||
return new Arguments8Splitting<>(v1, v2, v3, v4, v5, v6, v7, v8);
|
||||
}
|
||||
|
||||
public static <A1, A2, A3, A4, A5, A6, A7, A8, A9, R1, R2, R3, R4, R5, R6, R7, R8, R9> Arguments9Splitting<A1, A2, A3, A4, A5, A6, A7, A8, A9, R1, R2, R3, R4, R5, R6, R7, R8, R9> split(
|
||||
ValueValidator<? super A1, ? extends R1> v1,
|
||||
ValueValidator<? super A2, ? extends R2> v2,
|
||||
ValueValidator<? super A3, ? extends R3> v3,
|
||||
ValueValidator<? super A4, ? extends R4> v4,
|
||||
ValueValidator<? super A5, ? extends R5> v5,
|
||||
ValueValidator<? super A6, ? extends R6> v6,
|
||||
ValueValidator<? super A7, ? extends R7> v7,
|
||||
ValueValidator<? super A8, ? extends R8> v8,
|
||||
ValueValidator<? super A9, ? extends R9> v9) {
|
||||
return new Arguments9Splitting<>(v1, v2, v3, v4, v5, v6, v7, v8, v9);
|
||||
}
|
||||
|
||||
public static <A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, R1, R2, R3, R4, R5, R6, R7, R8, R9, R10> Arguments10Splitting<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, R1, R2, R3, R4, R5, R6, R7, R8, R9, R10> split(
|
||||
ValueValidator<? super A1, ? extends R1> v1,
|
||||
ValueValidator<? super A2, ? extends R2> v2,
|
||||
ValueValidator<? super A3, ? extends R3> v3,
|
||||
ValueValidator<? super A4, ? extends R4> v4,
|
||||
ValueValidator<? super A5, ? extends R5> v5,
|
||||
ValueValidator<? super A6, ? extends R6> v6,
|
||||
ValueValidator<? super A7, ? extends R7> v7,
|
||||
ValueValidator<? super A8, ? extends R8> v8,
|
||||
ValueValidator<? super A9, ? extends R9> v9,
|
||||
ValueValidator<? super A10, ? extends R10> v10) {
|
||||
return new Arguments10Splitting<>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10);
|
||||
}
|
||||
|
||||
public static <A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, R1, R2, R3, R4, R5, R6, R7, R8, R9, R10, R11> Arguments11Splitting<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, R1, R2, R3, R4, R5, R6, R7, R8, R9, R10, R11> split(
|
||||
ValueValidator<? super A1, ? extends R1> v1,
|
||||
ValueValidator<? super A2, ? extends R2> v2,
|
||||
ValueValidator<? super A3, ? extends R3> v3,
|
||||
ValueValidator<? super A4, ? extends R4> v4,
|
||||
ValueValidator<? super A5, ? extends R5> v5,
|
||||
ValueValidator<? super A6, ? extends R6> v6,
|
||||
ValueValidator<? super A7, ? extends R7> v7,
|
||||
ValueValidator<? super A8, ? extends R8> v8,
|
||||
ValueValidator<? super A9, ? extends R9> v9,
|
||||
ValueValidator<? super A10, ? extends R10> v10,
|
||||
ValueValidator<? super A11, ? extends R11> v11) {
|
||||
return new Arguments11Splitting<>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11);
|
||||
}
|
||||
|
||||
public static <A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, R1, R2, R3, R4, R5, R6, R7, R8, R9, R10, R11, R12> Arguments12Splitting<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, R1, R2, R3, R4, R5, R6, R7, R8, R9, R10, R11, R12> split(
|
||||
ValueValidator<? super A1, ? extends R1> v1,
|
||||
ValueValidator<? super A2, ? extends R2> v2,
|
||||
ValueValidator<? super A3, ? extends R3> v3,
|
||||
ValueValidator<? super A4, ? extends R4> v4,
|
||||
ValueValidator<? super A5, ? extends R5> v5,
|
||||
ValueValidator<? super A6, ? extends R6> v6,
|
||||
ValueValidator<? super A7, ? extends R7> v7,
|
||||
ValueValidator<? super A8, ? extends R8> v8,
|
||||
ValueValidator<? super A9, ? extends R9> v9,
|
||||
ValueValidator<? super A10, ? extends R10> v10,
|
||||
ValueValidator<? super A11, ? extends R11> v11,
|
||||
ValueValidator<? super A12, ? extends R12> v12) {
|
||||
return new Arguments12Splitting<>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11,
|
||||
v12);
|
||||
}
|
||||
|
||||
public static <A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, R1, R2, R3, R4, R5, R6, R7, R8, R9, R10, R11, R12, R13> Arguments13Splitting<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, R1, R2, R3, R4, R5, R6, R7, R8, R9, R10, R11, R12, R13> split(
|
||||
ValueValidator<? super A1, ? extends R1> v1,
|
||||
ValueValidator<? super A2, ? extends R2> v2,
|
||||
ValueValidator<? super A3, ? extends R3> v3,
|
||||
ValueValidator<? super A4, ? extends R4> v4,
|
||||
ValueValidator<? super A5, ? extends R5> v5,
|
||||
ValueValidator<? super A6, ? extends R6> v6,
|
||||
ValueValidator<? super A7, ? extends R7> v7,
|
||||
ValueValidator<? super A8, ? extends R8> v8,
|
||||
ValueValidator<? super A9, ? extends R9> v9,
|
||||
ValueValidator<? super A10, ? extends R10> v10,
|
||||
ValueValidator<? super A11, ? extends R11> v11,
|
||||
ValueValidator<? super A12, ? extends R12> v12,
|
||||
ValueValidator<? super A13, ? extends R13> v13) {
|
||||
return new Arguments13Splitting<>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11,
|
||||
v12, v13);
|
||||
}
|
||||
|
||||
public static <A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, R1, R2, R3, R4, R5, R6, R7, R8, R9, R10, R11, R12, R13, R14> Arguments14Splitting<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, R1, R2, R3, R4, R5, R6, R7, R8, R9, R10, R11, R12, R13, R14> split(
|
||||
ValueValidator<? super A1, ? extends R1> v1,
|
||||
ValueValidator<? super A2, ? extends R2> v2,
|
||||
ValueValidator<? super A3, ? extends R3> v3,
|
||||
ValueValidator<? super A4, ? extends R4> v4,
|
||||
ValueValidator<? super A5, ? extends R5> v5,
|
||||
ValueValidator<? super A6, ? extends R6> v6,
|
||||
ValueValidator<? super A7, ? extends R7> v7,
|
||||
ValueValidator<? super A8, ? extends R8> v8,
|
||||
ValueValidator<? super A9, ? extends R9> v9,
|
||||
ValueValidator<? super A10, ? extends R10> v10,
|
||||
ValueValidator<? super A11, ? extends R11> v11,
|
||||
ValueValidator<? super A12, ? extends R12> v12,
|
||||
ValueValidator<? super A13, ? extends R13> v13,
|
||||
ValueValidator<? super A14, ? extends R14> v14) {
|
||||
return new Arguments14Splitting<>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11,
|
||||
v12, v13, v14);
|
||||
}
|
||||
|
||||
public static <A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, R1, R2, R3, R4, R5, R6, R7, R8, R9, R10, R11, R12, R13, R14, R15> Arguments15Splitting<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, R1, R2, R3, R4, R5, R6, R7, R8, R9, R10, R11, R12, R13, R14, R15> split(
|
||||
ValueValidator<? super A1, ? extends R1> v1,
|
||||
ValueValidator<? super A2, ? extends R2> v2,
|
||||
ValueValidator<? super A3, ? extends R3> v3,
|
||||
ValueValidator<? super A4, ? extends R4> v4,
|
||||
ValueValidator<? super A5, ? extends R5> v5,
|
||||
ValueValidator<? super A6, ? extends R6> v6,
|
||||
ValueValidator<? super A7, ? extends R7> v7,
|
||||
ValueValidator<? super A8, ? extends R8> v8,
|
||||
ValueValidator<? super A9, ? extends R9> v9,
|
||||
ValueValidator<? super A10, ? extends R10> v10,
|
||||
ValueValidator<? super A11, ? extends R11> v11,
|
||||
ValueValidator<? super A12, ? extends R12> v12,
|
||||
ValueValidator<? super A13, ? extends R13> v13,
|
||||
ValueValidator<? super A14, ? extends R14> v14,
|
||||
ValueValidator<? super A15, ? extends R15> v15) {
|
||||
return new Arguments15Splitting<>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11,
|
||||
v12, v13, v14, v15);
|
||||
}
|
||||
|
||||
public static <A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, R1, R2, R3, R4, R5, R6, R7, R8, R9, R10, R11, R12, R13, R14, R15, R16> Arguments16Splitting<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, R1, R2, R3, R4, R5, R6, R7, R8, R9, R10, R11, R12, R13, R14, R15, R16> split(
|
||||
ValueValidator<? super A1, ? extends R1> v1,
|
||||
ValueValidator<? super A2, ? extends R2> v2,
|
||||
ValueValidator<? super A3, ? extends R3> v3,
|
||||
ValueValidator<? super A4, ? extends R4> v4,
|
||||
ValueValidator<? super A5, ? extends R5> v5,
|
||||
ValueValidator<? super A6, ? extends R6> v6,
|
||||
ValueValidator<? super A7, ? extends R7> v7,
|
||||
ValueValidator<? super A8, ? extends R8> v8,
|
||||
ValueValidator<? super A9, ? extends R9> v9,
|
||||
ValueValidator<? super A10, ? extends R10> v10,
|
||||
ValueValidator<? super A11, ? extends R11> v11,
|
||||
ValueValidator<? super A12, ? extends R12> v12,
|
||||
ValueValidator<? super A13, ? extends R13> v13,
|
||||
ValueValidator<? super A14, ? extends R14> v14,
|
||||
ValueValidator<? super A15, ? extends R15> v15,
|
||||
ValueValidator<? super A16, ? extends R16> v16) {
|
||||
return new Arguments16Splitting<>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11,
|
||||
v12, v13, v14, v15, v16);
|
||||
}
|
||||
|
||||
public static <A, R1, R2> Arguments2Combining<A, R1, R2> combine(
|
||||
ValueValidator<? super A, ? extends R1> v1,
|
||||
ValueValidator<? super A, ? extends R2> v2) {
|
||||
return new Arguments2Combining<>(v1, v2);
|
||||
}
|
||||
|
||||
public static <A, R1, R2, R3> Arguments3Combining<A, R1, R2, R3> combine(
|
||||
ValueValidator<? super A, ? extends R1> v1,
|
||||
ValueValidator<? super A, ? extends R2> v2,
|
||||
ValueValidator<? super A, ? extends R3> v3) {
|
||||
return new Arguments3Combining<>(v1, v2, v3);
|
||||
}
|
||||
|
||||
public static <A, R1, R2, R3, R4> Arguments4Combining<A, R1, R2, R3, R4> combine(
|
||||
ValueValidator<? super A, ? extends R1> v1,
|
||||
ValueValidator<? super A, ? extends R2> v2,
|
||||
ValueValidator<? super A, ? extends R3> v3,
|
||||
ValueValidator<? super A, ? extends R4> v4) {
|
||||
return new Arguments4Combining<>(v1, v2, v3, v4);
|
||||
}
|
||||
|
||||
public static <A, R1, R2, R3, R4, R5> Arguments5Combining<A, R1, R2, R3, R4, R5> combine(
|
||||
ValueValidator<? super A, ? extends R1> v1,
|
||||
ValueValidator<? super A, ? extends R2> v2,
|
||||
ValueValidator<? super A, ? extends R3> v3,
|
||||
ValueValidator<? super A, ? extends R4> v4,
|
||||
ValueValidator<? super A, ? extends R5> v5) {
|
||||
return new Arguments5Combining<>(v1, v2, v3, v4, v5);
|
||||
}
|
||||
|
||||
public static <A, R1, R2, R3, R4, R5, R6> Arguments6Combining<A, R1, R2, R3, R4, R5, R6> combine(
|
||||
ValueValidator<? super A, ? extends R1> v1,
|
||||
ValueValidator<? super A, ? extends R2> v2,
|
||||
ValueValidator<? super A, ? extends R3> v3,
|
||||
ValueValidator<? super A, ? extends R4> v4,
|
||||
ValueValidator<? super A, ? extends R5> v5,
|
||||
ValueValidator<? super A, ? extends R6> v6) {
|
||||
return new Arguments6Combining<>(v1, v2, v3, v4, v5, v6);
|
||||
}
|
||||
|
||||
public static <A, R1, R2, R3, R4, R5, R6, R7> Arguments7Combining<A, R1, R2, R3, R4, R5, R6, R7> combine(
|
||||
ValueValidator<? super A, ? extends R1> v1,
|
||||
ValueValidator<? super A, ? extends R2> v2,
|
||||
ValueValidator<? super A, ? extends R3> v3,
|
||||
ValueValidator<? super A, ? extends R4> v4,
|
||||
ValueValidator<? super A, ? extends R5> v5,
|
||||
ValueValidator<? super A, ? extends R6> v6,
|
||||
ValueValidator<? super A, ? extends R7> v7) {
|
||||
return new Arguments7Combining<>(v1, v2, v3, v4, v5, v6, v7);
|
||||
}
|
||||
|
||||
public static <A, R1, R2, R3, R4, R5, R6, R7, R8> Arguments8Combining<A, R1, R2, R3, R4, R5, R6, R7, R8> combine(
|
||||
ValueValidator<? super A, ? extends R1> v1,
|
||||
ValueValidator<? super A, ? extends R2> v2,
|
||||
ValueValidator<? super A, ? extends R3> v3,
|
||||
ValueValidator<? super A, ? extends R4> v4,
|
||||
ValueValidator<? super A, ? extends R5> v5,
|
||||
ValueValidator<? super A, ? extends R6> v6,
|
||||
ValueValidator<? super A, ? extends R7> v7,
|
||||
ValueValidator<? super A, ? extends R8> v8) {
|
||||
return new Arguments8Combining<>(v1, v2, v3, v4, v5, v6, v7, v8);
|
||||
}
|
||||
|
||||
public static <A, R1, R2, R3, R4, R5, R6, R7, R8, R9> Arguments9Combining<A, R1, R2, R3, R4, R5, R6, R7, R8, R9> combine(
|
||||
ValueValidator<? super A, ? extends R1> v1,
|
||||
ValueValidator<? super A, ? extends R2> v2,
|
||||
ValueValidator<? super A, ? extends R3> v3,
|
||||
ValueValidator<? super A, ? extends R4> v4,
|
||||
ValueValidator<? super A, ? extends R5> v5,
|
||||
ValueValidator<? super A, ? extends R6> v6,
|
||||
ValueValidator<? super A, ? extends R7> v7,
|
||||
ValueValidator<? super A, ? extends R8> v8,
|
||||
ValueValidator<? super A, ? extends R9> v9) {
|
||||
return new Arguments9Combining<>(v1, v2, v3, v4, v5, v6, v7, v8, v9);
|
||||
}
|
||||
|
||||
public static <A, R1, R2, R3, R4, R5, R6, R7, R8, R9, R10> Arguments10Combining<A, R1, R2, R3, R4, R5, R6, R7, R8, R9, R10> combine(
|
||||
ValueValidator<? super A, ? extends R1> v1,
|
||||
ValueValidator<? super A, ? extends R2> v2,
|
||||
ValueValidator<? super A, ? extends R3> v3,
|
||||
ValueValidator<? super A, ? extends R4> v4,
|
||||
ValueValidator<? super A, ? extends R5> v5,
|
||||
ValueValidator<? super A, ? extends R6> v6,
|
||||
ValueValidator<? super A, ? extends R7> v7,
|
||||
ValueValidator<? super A, ? extends R8> v8,
|
||||
ValueValidator<? super A, ? extends R9> v9,
|
||||
ValueValidator<? super A, ? extends R10> v10) {
|
||||
return new Arguments10Combining<>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10);
|
||||
}
|
||||
|
||||
public static <A, R1, R2, R3, R4, R5, R6, R7, R8, R9, R10, R11> Arguments11Combining<A, R1, R2, R3, R4, R5, R6, R7, R8, R9, R10, R11> combine(
|
||||
ValueValidator<? super A, ? extends R1> v1,
|
||||
ValueValidator<? super A, ? extends R2> v2,
|
||||
ValueValidator<? super A, ? extends R3> v3,
|
||||
ValueValidator<? super A, ? extends R4> v4,
|
||||
ValueValidator<? super A, ? extends R5> v5,
|
||||
ValueValidator<? super A, ? extends R6> v6,
|
||||
ValueValidator<? super A, ? extends R7> v7,
|
||||
ValueValidator<? super A, ? extends R8> v8,
|
||||
ValueValidator<? super A, ? extends R9> v9,
|
||||
ValueValidator<? super A, ? extends R10> v10,
|
||||
ValueValidator<? super A, ? extends R11> v11) {
|
||||
return new Arguments11Combining<>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11);
|
||||
}
|
||||
|
||||
public static <A, R1, R2, R3, R4, R5, R6, R7, R8, R9, R10, R11, R12> Arguments12Combining<A, R1, R2, R3, R4, R5, R6, R7, R8, R9, R10, R11, R12> combine(
|
||||
ValueValidator<? super A, ? extends R1> v1,
|
||||
ValueValidator<? super A, ? extends R2> v2,
|
||||
ValueValidator<? super A, ? extends R3> v3,
|
||||
ValueValidator<? super A, ? extends R4> v4,
|
||||
ValueValidator<? super A, ? extends R5> v5,
|
||||
ValueValidator<? super A, ? extends R6> v6,
|
||||
ValueValidator<? super A, ? extends R7> v7,
|
||||
ValueValidator<? super A, ? extends R8> v8,
|
||||
ValueValidator<? super A, ? extends R9> v9,
|
||||
ValueValidator<? super A, ? extends R10> v10,
|
||||
ValueValidator<? super A, ? extends R11> v11,
|
||||
ValueValidator<? super A, ? extends R12> v12) {
|
||||
return new Arguments12Combining<>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11,
|
||||
v12);
|
||||
}
|
||||
|
||||
public static <A, R1, R2, R3, R4, R5, R6, R7, R8, R9, R10, R11, R12, R13> Arguments13Combining<A, R1, R2, R3, R4, R5, R6, R7, R8, R9, R10, R11, R12, R13> combine(
|
||||
ValueValidator<? super A, ? extends R1> v1,
|
||||
ValueValidator<? super A, ? extends R2> v2,
|
||||
ValueValidator<? super A, ? extends R3> v3,
|
||||
ValueValidator<? super A, ? extends R4> v4,
|
||||
ValueValidator<? super A, ? extends R5> v5,
|
||||
ValueValidator<? super A, ? extends R6> v6,
|
||||
ValueValidator<? super A, ? extends R7> v7,
|
||||
ValueValidator<? super A, ? extends R8> v8,
|
||||
ValueValidator<? super A, ? extends R9> v9,
|
||||
ValueValidator<? super A, ? extends R10> v10,
|
||||
ValueValidator<? super A, ? extends R11> v11,
|
||||
ValueValidator<? super A, ? extends R12> v12,
|
||||
ValueValidator<? super A, ? extends R13> v13) {
|
||||
return new Arguments13Combining<>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11,
|
||||
v12, v13);
|
||||
}
|
||||
|
||||
public static <A, R1, R2, R3, R4, R5, R6, R7, R8, R9, R10, R11, R12, R13, R14> Arguments14Combining<A, R1, R2, R3, R4, R5, R6, R7, R8, R9, R10, R11, R12, R13, R14> combine(
|
||||
ValueValidator<? super A, ? extends R1> v1,
|
||||
ValueValidator<? super A, ? extends R2> v2,
|
||||
ValueValidator<? super A, ? extends R3> v3,
|
||||
ValueValidator<? super A, ? extends R4> v4,
|
||||
ValueValidator<? super A, ? extends R5> v5,
|
||||
ValueValidator<? super A, ? extends R6> v6,
|
||||
ValueValidator<? super A, ? extends R7> v7,
|
||||
ValueValidator<? super A, ? extends R8> v8,
|
||||
ValueValidator<? super A, ? extends R9> v9,
|
||||
ValueValidator<? super A, ? extends R10> v10,
|
||||
ValueValidator<? super A, ? extends R11> v11,
|
||||
ValueValidator<? super A, ? extends R12> v12,
|
||||
ValueValidator<? super A, ? extends R13> v13,
|
||||
ValueValidator<? super A, ? extends R14> v14) {
|
||||
return new Arguments14Combining<>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11,
|
||||
v12, v13, v14);
|
||||
}
|
||||
|
||||
public static <A, R1, R2, R3, R4, R5, R6, R7, R8, R9, R10, R11, R12, R13, R14, R15> Arguments15Combining<A, R1, R2, R3, R4, R5, R6, R7, R8, R9, R10, R11, R12, R13, R14, R15> combine(
|
||||
ValueValidator<? super A, ? extends R1> v1,
|
||||
ValueValidator<? super A, ? extends R2> v2,
|
||||
ValueValidator<? super A, ? extends R3> v3,
|
||||
ValueValidator<? super A, ? extends R4> v4,
|
||||
ValueValidator<? super A, ? extends R5> v5,
|
||||
ValueValidator<? super A, ? extends R6> v6,
|
||||
ValueValidator<? super A, ? extends R7> v7,
|
||||
ValueValidator<? super A, ? extends R8> v8,
|
||||
ValueValidator<? super A, ? extends R9> v9,
|
||||
ValueValidator<? super A, ? extends R10> v10,
|
||||
ValueValidator<? super A, ? extends R11> v11,
|
||||
ValueValidator<? super A, ? extends R12> v12,
|
||||
ValueValidator<? super A, ? extends R13> v13,
|
||||
ValueValidator<? super A, ? extends R14> v14,
|
||||
ValueValidator<? super A, ? extends R15> v15) {
|
||||
return new Arguments15Combining<>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11,
|
||||
v12, v13, v14, v15);
|
||||
}
|
||||
|
||||
public static <A, R1, R2, R3, R4, R5, R6, R7, R8, R9, R10, R11, R12, R13, R14, R15, R16> Arguments16Combining<A, R1, R2, R3, R4, R5, R6, R7, R8, R9, R10, R11, R12, R13, R14, R15, R16> combine(
|
||||
ValueValidator<? super A, ? extends R1> v1,
|
||||
ValueValidator<? super A, ? extends R2> v2,
|
||||
ValueValidator<? super A, ? extends R3> v3,
|
||||
ValueValidator<? super A, ? extends R4> v4,
|
||||
ValueValidator<? super A, ? extends R5> v5,
|
||||
ValueValidator<? super A, ? extends R6> v6,
|
||||
ValueValidator<? super A, ? extends R7> v7,
|
||||
ValueValidator<? super A, ? extends R8> v8,
|
||||
ValueValidator<? super A, ? extends R9> v9,
|
||||
ValueValidator<? super A, ? extends R10> v10,
|
||||
ValueValidator<? super A, ? extends R11> v11,
|
||||
ValueValidator<? super A, ? extends R12> v12,
|
||||
ValueValidator<? super A, ? extends R13> v13,
|
||||
ValueValidator<? super A, ? extends R14> v14,
|
||||
ValueValidator<? super A, ? extends R15> v15,
|
||||
ValueValidator<? super A, ? extends R16> v16) {
|
||||
return new Arguments16Combining<>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11,
|
||||
v12, v13, v14, v15, v16);
|
||||
}
|
||||
|
||||
public static <A1, R, T> Arguments1Validator<A1, List<R>> traverse1(
|
||||
Iterable<T> values,
|
||||
Function<? super T, ? extends Arguments1Validator<? super A1, ? extends R>> f) {
|
||||
return (a1, locale, constraintContext) -> Validated.traverse(values, f
|
||||
.andThen(validator -> validator.validate(a1, locale, constraintContext)));
|
||||
}
|
||||
|
||||
public static <A1, A2, R, T> Arguments2Validator<A1, A2, List<R>> traverse2(
|
||||
Iterable<T> values,
|
||||
Function<? super T, ? extends Arguments2Validator<? super A1, ? super A2, ? extends R>> f) {
|
||||
return (a1, a2, locale, constraintContext) -> Validated.traverse(values,
|
||||
f.andThen(validator -> validator.validate(a1, a2, locale,
|
||||
constraintContext)));
|
||||
}
|
||||
|
||||
public static <A1, A2, A3, R, T> Arguments3Validator<A1, A2, A3, List<R>> traverse3(
|
||||
Iterable<T> values,
|
||||
Function<? super T, ? extends Arguments3Validator<? super A1, ? super A2, ? super A3, ? extends R>> f) {
|
||||
return (a1, a2, a3, locale, constraintContext) -> Validated.traverse(values,
|
||||
f.andThen(validator -> validator.validate(a1, a2, a3, locale,
|
||||
constraintContext)));
|
||||
}
|
||||
|
||||
public static <A1, A2, A3, A4, R, T> Arguments4Validator<A1, A2, A3, A4, List<R>> traverse4(
|
||||
Iterable<T> values,
|
||||
Function<? super T, ? extends Arguments4Validator<? super A1, ? super A2, ? super A3, ? super A4, ? extends R>> f) {
|
||||
return (a1, a2, a3, a4, locale, constraintContext) -> Validated.traverse(values,
|
||||
f.andThen(validator -> validator.validate(a1, a2, a3, a4, locale,
|
||||
constraintContext)));
|
||||
}
|
||||
|
||||
public static <A1, A2, A3, A4, A5, R, T> Arguments5Validator<A1, A2, A3, A4, A5, List<R>> traverse5(
|
||||
Iterable<T> values,
|
||||
Function<? super T, ? extends Arguments5Validator<? super A1, ? super A2, ? super A3, ? super A4, ? super A5, ? extends R>> f) {
|
||||
return (a1, a2, a3, a4, a5, locale, constraintContext) -> Validated
|
||||
.traverse(values, f.andThen(validator -> validator.validate(a1, a2, a3,
|
||||
a4, a5, locale, constraintContext)));
|
||||
}
|
||||
|
||||
public static <A1, A2, A3, A4, A5, A6, R, T> Arguments6Validator<A1, A2, A3, A4, A5, A6, List<R>> traverse6(
|
||||
Iterable<T> values,
|
||||
Function<? super T, ? extends Arguments6Validator<? super A1, ? super A2, ? super A3, ? super A4, ? super A5, ? super A6, ? extends R>> f) {
|
||||
return (a1, a2, a3, a4, a5, a6, locale, constraintContext) -> Validated
|
||||
.traverse(values, f.andThen(validator -> validator.validate(a1, a2, a3,
|
||||
a4, a5, a6, locale, constraintContext)));
|
||||
}
|
||||
|
||||
public static <A1, A2, A3, A4, A5, A6, A7, R, T> Arguments7Validator<A1, A2, A3, A4, A5, A6, A7, List<R>> traverse7(
|
||||
Iterable<T> values,
|
||||
Function<? super T, ? extends Arguments7Validator<? super A1, ? super A2, ? super A3, ? super A4, ? super A5, ? super A6, ? super A7, ? extends R>> f) {
|
||||
return (a1, a2, a3, a4, a5, a6, a7, locale, constraintContext) -> Validated
|
||||
.traverse(values, f.andThen(validator -> validator.validate(a1, a2, a3,
|
||||
a4, a5, a6, a7, locale, constraintContext)));
|
||||
}
|
||||
|
||||
public static <A1, A2, A3, A4, A5, A6, A7, A8, R, T> Arguments8Validator<A1, A2, A3, A4, A5, A6, A7, A8, List<R>> traverse8(
|
||||
Iterable<T> values,
|
||||
Function<? super T, ? extends Arguments8Validator<? super A1, ? super A2, ? super A3, ? super A4, ? super A5, ? super A6, ? super A7, ? super A8, ? extends R>> f) {
|
||||
return (a1, a2, a3, a4, a5, a6, a7, a8, locale, constraintContext) -> Validated
|
||||
.traverse(values, f.andThen(validator -> validator.validate(a1, a2, a3,
|
||||
a4, a5, a6, a7, a8, locale, constraintContext)));
|
||||
}
|
||||
|
||||
public static <A1, A2, A3, A4, A5, A6, A7, A8, A9, R, T> Arguments9Validator<A1, A2, A3, A4, A5, A6, A7, A8, A9, List<R>> traverse9(
|
||||
Iterable<T> values,
|
||||
Function<? super T, ? extends Arguments9Validator<? super A1, ? super A2, ? super A3, ? super A4, ? super A5, ? super A6, ? super A7, ? super A8, ? super A9, ? extends R>> f) {
|
||||
return (a1, a2, a3, a4, a5, a6, a7, a8, a9, locale,
|
||||
constraintContext) -> Validated.traverse(values,
|
||||
f.andThen(validator -> validator.validate(a1, a2, a3, a4, a5, a6,
|
||||
a7, a8, a9, locale, constraintContext)));
|
||||
}
|
||||
|
||||
public static <A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, R, T> Arguments10Validator<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, List<R>> traverse10(
|
||||
Iterable<T> values,
|
||||
Function<? super T, ? extends Arguments10Validator<? super A1, ? super A2, ? super A3, ? super A4, ? super A5, ? super A6, ? super A7, ? super A8, ? super A9, ? super A10, ? extends R>> f) {
|
||||
return (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, locale,
|
||||
constraintContext) -> Validated.traverse(values,
|
||||
f.andThen(validator -> validator.validate(a1, a2, a3, a4, a5, a6,
|
||||
a7, a8, a9, a10, locale, constraintContext)));
|
||||
}
|
||||
|
||||
public static <A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, R, T> Arguments11Validator<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, List<R>> traverse11(
|
||||
Iterable<T> values,
|
||||
Function<? super T, ? extends Arguments11Validator<? super A1, ? super A2, ? super A3, ? super A4, ? super A5, ? super A6, ? super A7, ? super A8, ? super A9, ? super A10, ? super A11, ? extends R>> f) {
|
||||
return (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, locale,
|
||||
constraintContext) -> Validated.traverse(values,
|
||||
f.andThen(validator -> validator.validate(a1, a2, a3, a4, a5, a6,
|
||||
a7, a8, a9, a10, a11, locale, constraintContext)));
|
||||
}
|
||||
|
||||
public static <A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, R, T> Arguments12Validator<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, List<R>> traverse12(
|
||||
Iterable<T> values,
|
||||
Function<? super T, ? extends Arguments12Validator<? super A1, ? super A2, ? super A3, ? super A4, ? super A5, ? super A6, ? super A7, ? super A8, ? super A9, ? super A10, ? super A11, ? super A12, ? extends R>> f) {
|
||||
return (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, locale,
|
||||
constraintContext) -> Validated.traverse(values,
|
||||
f.andThen(validator -> validator.validate(a1, a2, a3, a4, a5, a6,
|
||||
a7, a8, a9, a10, a11, a12, locale, constraintContext)));
|
||||
}
|
||||
|
||||
public static <A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, R, T> Arguments13Validator<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, List<R>> traverse13(
|
||||
Iterable<T> values,
|
||||
Function<? super T, ? extends Arguments13Validator<? super A1, ? super A2, ? super A3, ? super A4, ? super A5, ? super A6, ? super A7, ? super A8, ? super A9, ? super A10, ? super A11, ? super A12, ? super A13, ? extends R>> f) {
|
||||
return (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, locale,
|
||||
constraintContext) -> Validated.traverse(values,
|
||||
f.andThen(validator -> validator.validate(a1, a2, a3, a4, a5, a6,
|
||||
a7, a8, a9, a10, a11, a12, a13, locale,
|
||||
constraintContext)));
|
||||
}
|
||||
|
||||
public static <A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, R, T> Arguments14Validator<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, List<R>> traverse14(
|
||||
Iterable<T> values,
|
||||
Function<? super T, ? extends Arguments14Validator<? super A1, ? super A2, ? super A3, ? super A4, ? super A5, ? super A6, ? super A7, ? super A8, ? super A9, ? super A10, ? super A11, ? super A12, ? super A13, ? super A14, ? extends R>> f) {
|
||||
return (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, locale,
|
||||
constraintContext) -> Validated.traverse(values,
|
||||
f.andThen(validator -> validator.validate(a1, a2, a3, a4, a5, a6,
|
||||
a7, a8, a9, a10, a11, a12, a13, a14, locale,
|
||||
constraintContext)));
|
||||
}
|
||||
|
||||
public static <A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, R, T> Arguments15Validator<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, List<R>> traverse15(
|
||||
Iterable<T> values,
|
||||
Function<? super T, ? extends Arguments15Validator<? super A1, ? super A2, ? super A3, ? super A4, ? super A5, ? super A6, ? super A7, ? super A8, ? super A9, ? super A10, ? super A11, ? super A12, ? super A13, ? super A14, ? super A15, ? extends R>> f) {
|
||||
return (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, locale,
|
||||
constraintContext) -> Validated.traverse(values,
|
||||
f.andThen(validator -> validator.validate(a1, a2, a3, a4, a5, a6,
|
||||
a7, a8, a9, a10, a11, a12, a13, a14, a15, locale,
|
||||
constraintContext)));
|
||||
}
|
||||
|
||||
public static <A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, R, T> Arguments16Validator<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, List<R>> traverse16(
|
||||
Iterable<T> values,
|
||||
Function<? super T, ? extends Arguments16Validator<? super A1, ? super A2, ? super A3, ? super A4, ? super A5, ? super A6, ? super A7, ? super A8, ? super A9, ? super A10, ? super A11, ? super A12, ? super A13, ? super A14, ? super A15, ? super A16, ? extends R>> f) {
|
||||
return (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16,
|
||||
locale, constraintContext) -> Validated.traverse(values,
|
||||
f.andThen(validator -> validator.validate(a1, a2, a3, a4, a5, a6,
|
||||
a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, locale,
|
||||
constraintContext)));
|
||||
}
|
||||
|
||||
public static <A1, R> Arguments1Validator<A1, List<R>> sequence1(
|
||||
Iterable<? extends Arguments1Validator<? super A1, ? extends R>> values) {
|
||||
return traverse1(values, identity());
|
||||
}
|
||||
|
||||
public static <A1, A2, R> Arguments2Validator<A1, A2, List<R>> sequence2(
|
||||
Iterable<? extends Arguments2Validator<? super A1, ? super A2, ? extends R>> values) {
|
||||
return traverse2(values, identity());
|
||||
}
|
||||
|
||||
public static <A1, A2, A3, R> Arguments3Validator<A1, A2, A3, List<R>> sequence3(
|
||||
Iterable<? extends Arguments3Validator<? super A1, ? super A2, ? super A3, ? extends R>> values) {
|
||||
return traverse3(values, identity());
|
||||
}
|
||||
|
||||
public static <A1, A2, A3, A4, R> Arguments4Validator<A1, A2, A3, A4, List<R>> sequence4(
|
||||
Iterable<? extends Arguments4Validator<? super A1, ? super A2, ? super A3, ? super A4, ? extends R>> values) {
|
||||
return traverse4(values, identity());
|
||||
}
|
||||
|
||||
public static <A1, A2, A3, A4, A5, R> Arguments5Validator<A1, A2, A3, A4, A5, List<R>> sequence5(
|
||||
Iterable<? extends Arguments5Validator<? super A1, ? super A2, ? super A3, ? super A4, ? super A5, ? extends R>> values) {
|
||||
return traverse5(values, identity());
|
||||
}
|
||||
|
||||
public static <A1, A2, A3, A4, A5, A6, R> Arguments6Validator<A1, A2, A3, A4, A5, A6, List<R>> sequence6(
|
||||
Iterable<? extends Arguments6Validator<? super A1, ? super A2, ? super A3, ? super A4, ? super A5, ? super A6, ? extends R>> values) {
|
||||
return traverse6(values, identity());
|
||||
}
|
||||
|
||||
public static <A1, A2, A3, A4, A5, A6, A7, R> Arguments7Validator<A1, A2, A3, A4, A5, A6, A7, List<R>> sequence7(
|
||||
Iterable<? extends Arguments7Validator<? super A1, ? super A2, ? super A3, ? super A4, ? super A5, ? super A6, ? super A7, ? extends R>> values) {
|
||||
return traverse7(values, identity());
|
||||
}
|
||||
|
||||
public static <A1, A2, A3, A4, A5, A6, A7, A8, R> Arguments8Validator<A1, A2, A3, A4, A5, A6, A7, A8, List<R>> sequence8(
|
||||
Iterable<? extends Arguments8Validator<? super A1, ? super A2, ? super A3, ? super A4, ? super A5, ? super A6, ? super A7, ? super A8, ? extends R>> values) {
|
||||
return traverse8(values, identity());
|
||||
}
|
||||
|
||||
public static <A1, A2, A3, A4, A5, A6, A7, A8, A9, R> Arguments9Validator<A1, A2, A3, A4, A5, A6, A7, A8, A9, List<R>> sequence9(
|
||||
Iterable<? extends Arguments9Validator<? super A1, ? super A2, ? super A3, ? super A4, ? super A5, ? super A6, ? super A7, ? super A8, ? super A9, ? extends R>> values) {
|
||||
return traverse9(values, identity());
|
||||
}
|
||||
|
||||
public static <A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, R> Arguments10Validator<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, List<R>> sequence10(
|
||||
Iterable<? extends Arguments10Validator<? super A1, ? super A2, ? super A3, ? super A4, ? super A5, ? super A6, ? super A7, ? super A8, ? super A9, ? super A10, ? extends R>> values) {
|
||||
return traverse10(values, identity());
|
||||
}
|
||||
|
||||
public static <A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, R> Arguments11Validator<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, List<R>> sequence11(
|
||||
Iterable<? extends Arguments11Validator<? super A1, ? super A2, ? super A3, ? super A4, ? super A5, ? super A6, ? super A7, ? super A8, ? super A9, ? super A10, ? super A11, ? extends R>> values) {
|
||||
return traverse11(values, identity());
|
||||
}
|
||||
|
||||
public static <A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, R> Arguments12Validator<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, List<R>> sequence12(
|
||||
Iterable<? extends Arguments12Validator<? super A1, ? super A2, ? super A3, ? super A4, ? super A5, ? super A6, ? super A7, ? super A8, ? super A9, ? super A10, ? super A11, ? super A12, ? extends R>> values) {
|
||||
return traverse12(values, identity());
|
||||
}
|
||||
|
||||
public static <A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, R> Arguments13Validator<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, List<R>> sequence13(
|
||||
Iterable<? extends Arguments13Validator<? super A1, ? super A2, ? super A3, ? super A4, ? super A5, ? super A6, ? super A7, ? super A8, ? super A9, ? super A10, ? super A11, ? super A12, ? super A13, ? extends R>> values) {
|
||||
return traverse13(values, identity());
|
||||
}
|
||||
|
||||
public static <A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, R> Arguments14Validator<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, List<R>> sequence14(
|
||||
Iterable<? extends Arguments14Validator<? super A1, ? super A2, ? super A3, ? super A4, ? super A5, ? super A6, ? super A7, ? super A8, ? super A9, ? super A10, ? super A11, ? super A12, ? super A13, ? super A14, ? extends R>> values) {
|
||||
return traverse14(values, identity());
|
||||
}
|
||||
|
||||
public static <A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, R> Arguments15Validator<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, List<R>> sequence15(
|
||||
Iterable<? extends Arguments15Validator<? super A1, ? super A2, ? super A3, ? super A4, ? super A5, ? super A6, ? super A7, ? super A8, ? super A9, ? super A10, ? super A11, ? super A12, ? super A13, ? super A14, ? super A15, ? extends R>> values) {
|
||||
return traverse15(values, identity());
|
||||
}
|
||||
|
||||
public static <A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, R> Arguments16Validator<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, List<R>> sequence16(
|
||||
Iterable<? extends Arguments16Validator<? super A1, ? super A2, ? super A3, ? super A4, ? super A5, ? super A6, ? super A7, ? super A8, ? super A9, ? super A10, ? super A11, ? super A12, ? super A13, ? super A14, ? super A15, ? super A16, ? extends R>> values) {
|
||||
return traverse16(values, identity());
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 0.8.0
|
||||
*/
|
||||
public static <A1, R, C extends Collection<R>> Arguments1Validator<Iterable<A1>, C> liftCollection(
|
||||
ValueValidator<? super A1, ? extends R> validator, Supplier<C> factory) {
|
||||
return Arguments1Validator
|
||||
.from(ValueValidator.liftCollection(validator, factory));
|
||||
}
|
||||
|
||||
public static <A1, R> Arguments1Validator<Iterable<A1>, List<R>> liftList(
|
||||
ValueValidator<? super A1, ? extends R> validator) {
|
||||
return Arguments1Validator.from(ValueValidator.liftList(validator));
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 0.8.0
|
||||
*/
|
||||
public static <A1, R> Arguments1Validator<Iterable<A1>, Set<R>> liftSet(
|
||||
ValueValidator<? super A1, ? extends R> validator) {
|
||||
return Arguments1Validator.from(ValueValidator.liftSet(validator));
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 0.8.0
|
||||
*/
|
||||
public static <A1, R> Arguments1Validator<Optional<A1>, Optional<R>> liftOptional(
|
||||
ValueValidator<? super A1, ? extends R> validator) {
|
||||
return Arguments1Validator.from(ValueValidator.liftOptional(validator));
|
||||
}
|
||||
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue