Package yapion.hierarchy.validators
Class Validator
- java.lang.Object
-
- yapion.hierarchy.validators.Validator
-
public final class Validator extends java.lang.Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Validator.ValidationOption
-
Constructor Summary
Constructors Constructor Description Validator()
-
Method Summary
Modifier and Type Method Description Validator
add(Validator validator)
Validator
add(ValidatorVariable variable)
Add a newValidatorVariable
which will validate a small portion of anyYAPIONObject
.Validator
setValidationHook(ValidationHook validationHook)
JavaDoc found underValidationHook
java.lang.String
toString()
boolean
validate(YAPIONObject yapionObject)
Validate a specifiedYAPIONObject
with the specifiedValidatorVariable
's given by the user.static Validator
validator(YAPIONObject yapionObject)
static Validator
validator(YAPIONObject yapionObject, Validator.ValidationOption... validationOptions)
-
-
-
Method Detail
-
setValidationHook
public Validator setValidationHook(ValidationHook validationHook)
JavaDoc found underValidationHook
- Parameters:
validationHook
- theValidationHook
to use
-
add
public Validator add(ValidatorVariable variable)
Add a newValidatorVariable
which will validate a small portion of anyYAPIONObject
. This method throws anYAPIONException
if the path in theValidatorVariable
isnull
or the type isnull
.- Parameters:
variable
- theValidatorVariable
to add
-
validate
public boolean validate(YAPIONObject yapionObject)
Validate a specifiedYAPIONObject
with the specifiedValidatorVariable
's given by the user.- Parameters:
yapionObject
- theYAPIONObject
to validate- Returns:
true
if theYAPIONObject
was valid,false
otherwise
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
validator
public static Validator validator(YAPIONObject yapionObject)
- Parameters:
yapionObject
- the exampleYAPIONObject
- Returns:
- the
Validator
for the givenYAPIONObject
-
validator
public static Validator validator(YAPIONObject yapionObject, Validator.ValidationOption... validationOptions)
- Parameters:
yapionObject
- the exampleYAPIONObject
validationOptions
- what the validator should validate- Returns:
- the
Validator
for the givenYAPIONObject
-
-