public static class ConstraintSerialization.PredicateSerializationRuleAdder<T>
extends java.lang.Object
Constructor and Description |
---|
PredicateSerializationRuleAdder(java.util.function.Function<T,<any>> constructor,
java.util.function.Function<java.util.List<?>,T> constructorArgsFromList,
T constructorSampleInput) |
Modifier and Type | Method and Description |
---|---|
void |
add(ConstraintSerialization constraintSerialization) |
ConstraintSerialization.PredicateSerializationRuleAdder<T> |
equivalentNames(java.lang.String... equivs)
Other predicates which are different to the type indicated by
#sample(Predicate) but equivalent,
and after serialization will be represented by preferredName and after deserialization
will result in the Predicate produced by constructor . |
ConstraintSerialization.PredicateSerializationRuleAdder<T> |
equivalentPredicates(<any>... equivs)
Other predicates which are different to the type indicated by
#sample(Predicate) but equivalent,
and after serialization will be represented by preferredName and after deserialization
will result in the Predicate produced by constructor . |
static ConstraintSerialization.PredicateSerializationRuleAdder<java.util.List<java.lang.String>> |
listConstructor(java.util.function.Function<java.util.List<java.lang.String>,<any>> constructor) |
static ConstraintSerialization.PredicateSerializationRuleAdder<java.lang.Void> |
noArgConstructor(java.util.function.Supplier<<any>> constructor) |
static ConstraintSerialization.PredicateSerializationRuleAdder<java.util.List<<any>>> |
predicateListConstructor(java.util.function.Function<java.util.List<<any>>,<any>> constructor) |
ConstraintSerialization.PredicateSerializationRuleAdder<T> |
preferredName(java.lang.String preferredName)
Preferred name for predicate when serializing.
|
ConstraintSerialization.PredicateSerializationRuleAdder<T> |
sample(<any> samplePreferredPredicate)
Sample of what the
constructor will produce, used to recognise this rule when parsing. |
ConstraintSerialization.PredicateSerializationRuleAdder<T> |
sampleArg(T arg)
This should supply args accepted by
constructor to generate a #sample(Predicate) . |
static ConstraintSerialization.PredicateSerializationRuleAdder<java.lang.String> |
stringConstructor(java.util.function.Function<java.lang.String,<any>> constructor) |
public static ConstraintSerialization.PredicateSerializationRuleAdder<java.util.List<<any>>> predicateListConstructor(java.util.function.Function<java.util.List<<any>>,<any>> constructor)
public static ConstraintSerialization.PredicateSerializationRuleAdder<java.lang.String> stringConstructor(java.util.function.Function<java.lang.String,<any>> constructor)
public static ConstraintSerialization.PredicateSerializationRuleAdder<java.util.List<java.lang.String>> listConstructor(java.util.function.Function<java.util.List<java.lang.String>,<any>> constructor)
public static ConstraintSerialization.PredicateSerializationRuleAdder<java.lang.Void> noArgConstructor(java.util.function.Supplier<<any>> constructor)
public ConstraintSerialization.PredicateSerializationRuleAdder<T> preferredName(java.lang.String preferredName)
#sample(Predicate)
.public ConstraintSerialization.PredicateSerializationRuleAdder<T> equivalentNames(java.lang.String... equivs)
#sample(Predicate)
but equivalent,
and after serialization will be represented by preferredName
and after deserialization
will result in the Predicate
produced by constructor
.public ConstraintSerialization.PredicateSerializationRuleAdder<T> sample(<any> samplePreferredPredicate)
constructor
will produce, used to recognise this rule when parsing.
Can be omitted if sampleArg(Object)
supplied or its default is accepted.public ConstraintSerialization.PredicateSerializationRuleAdder<T> sampleArg(T arg)
constructor
to generate a #sample(Predicate)
.
At most one of this or #sample(Predicate)
should be supplied.
If the constructor accepts a default empty list/string/null then these can be omitted.public ConstraintSerialization.PredicateSerializationRuleAdder<T> equivalentPredicates(<any>... equivs)
#sample(Predicate)
but equivalent,
and after serialization will be represented by preferredName
and after deserialization
will result in the Predicate
produced by constructor
.public void add(ConstraintSerialization constraintSerialization)