Package yapion.hierarchy.validators
Class ValidatorCluster
- java.lang.Object
-
- yapion.hierarchy.validators.ValidatorCluster
-
public final class ValidatorCluster extends java.lang.Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ValidatorCluster.ClusterMode
-
Constructor Summary
Constructors Constructor Description ValidatorCluster()
-
Method Summary
Modifier and Type Method Description ValidatorCluster
add(Validator validator)
Add a newValidator
to thisValidatorCluster
.boolean
validate(YAPIONObject yapionObject)
Checks if the inputtedYAPIONObject
matches oneValidator
.boolean
validate(YAPIONObject yapionObject, int validNumber)
Checks if the inputtedYAPIONObject
matches oneValidator
.boolean
validate(ValidatorCluster.ClusterMode clusterMode, YAPIONObject yapionObject)
Checks if the inputtedYAPIONObject
matches theValidator
with the specifiedValidatorCluster.ClusterMode
.boolean
validate(ValidatorCluster.ClusterMode clusterMode, YAPIONObject yapionObject, int validNumber)
Checks if the inputtedYAPIONObject
matches theValidator
with the specifiedValidatorCluster.ClusterMode
.
-
-
-
Method Detail
-
add
public ValidatorCluster add(Validator validator)
Add a newValidator
to thisValidatorCluster
.- Parameters:
validator
- theValidator
to add
-
validate
public boolean validate(YAPIONObject yapionObject)
Checks if the inputtedYAPIONObject
matches oneValidator
. It uses theValidatorCluster.ClusterMode.ANY_VALID
.- Parameters:
yapionObject
- theYAPIONObject
to validate- Returns:
true
if anyValidator
returnstrue
,false
otherwise
-
validate
public boolean validate(YAPIONObject yapionObject, int validNumber)
Checks if the inputtedYAPIONObject
matches oneValidator
. It uses theValidatorCluster.ClusterMode.LEAST_VALID
.- Parameters:
yapionObject
- theYAPIONObject
to validatevalidNumber
- theValidator
threshold- Returns:
true
if at least nValidator
's returnedtrue
,false
otherwise
-
validate
public boolean validate(ValidatorCluster.ClusterMode clusterMode, YAPIONObject yapionObject)
Checks if the inputtedYAPIONObject
matches theValidator
with the specifiedValidatorCluster.ClusterMode
.- Parameters:
clusterMode
- theValidatorCluster.ClusterMode
to useyapionObject
- theYAPIONObject
to validate- Returns:
true
if the specification of theClusterMode
are metValidatorCluster.ClusterMode.ANY_VALID
andValidatorCluster.ClusterMode.LEAST_VALID
will behave the sameValidatorCluster.ClusterMode.SPECIFIC_VALID
will behave as one and only one is validValidatorCluster.ClusterMode.MOST_VALID
will behave as one valid or none valid
-
validate
public boolean validate(ValidatorCluster.ClusterMode clusterMode, YAPIONObject yapionObject, int validNumber)
Checks if the inputtedYAPIONObject
matches theValidator
with the specifiedValidatorCluster.ClusterMode
.- Parameters:
clusterMode
- theValidatorCluster.ClusterMode
to useyapionObject
- theYAPIONObject
to validatevalidNumber
- theValidator
threshold- Returns:
true
if the specification of theValidatorCluster.ClusterMode
are met,false
otherwise
-
-