public class JsonObjectValidationSetDefault extends ValidationSetDefault implements JsonObjectValidationSet
loggerVALIDATION_CODE_BLANK, VALIDATION_CODE_CAN_BE_CONVERTED_TO, VALIDATION_CODE_EMAIL, VALIDATION_CODE_EQUIVALENT, VALIDATION_CODE_EQUIVALENT_OR_GREATER, VALIDATION_CODE_EQUIVALENT_OR_LESS, VALIDATION_CODE_GREATER, VALIDATION_CODE_IS_OF_TYPE, VALIDATION_CODE_LENGTH, VALIDATION_CODE_LESS, VALIDATION_CODE_MAX_LENGTH, VALIDATION_CODE_MAX_SIZE, VALIDATION_CODE_MIN_LENGTH, VALIDATION_CODE_MIN_SIZE, VALIDATION_CODE_NOT_AN_ARRAY, VALIDATION_CODE_NOT_BLANK, VALIDATION_CODE_NOT_EQUIVALENT, VALIDATION_CODE_NOT_NULL, VALIDATION_CODE_NOT_PATTERN, VALIDATION_CODE_NULL, VALIDATION_CODE_PATTERN, VALIDATION_CODE_SIZE, VALIDATION_CODE_WHOLE_ARRAY_VALIDATION_RESULT_TYPE| Constructor and Description |
|---|
JsonObjectValidationSetDefault(JsonObjectOrArray validatedObject,
ValidationFactory validationFactory,
SpincastDictionary spincastDictionary,
JsonManager jsonManager,
XmlManager xmlManager,
ObjectConverter objectConverter) |
JsonObjectValidationSetDefault(JsonObject validatedObject,
ValidationFactory validationFactory,
SpincastDictionary spincastDictionary,
JsonManager jsonManager,
XmlManager xmlManager,
ObjectConverter objectConverter) |
| Modifier and Type | Method and Description |
|---|---|
protected SimpleValidator |
getCanBeConvertedToValidator(Class<?> referenceType) |
protected Map<String,SimpleValidator> |
getCanBeConvertedToValidators() |
protected SimpleValidator |
getIsOfTypeByteArrayValidator(boolean acceptBase64StringToo) |
protected SimpleValidator |
getIsOfTypeValidator(Class<?> referenceType) |
protected Map<String,SimpleValidator> |
getIsOfTypeValidators() |
protected JsonObjectOrArray |
getValidatedObject() |
JsonObjectValidationBuilderKey |
validation(SimpleValidator validator)
Starts a validation using a
custom
SimpleValidator. |
JsonObjectValidationBuilderKey |
validationBlank()
Starts the creation of a "must be blank" validation.
|
protected JsonObjectValidationBuilderKey |
validationCanBeConvertedTo(Class<?> referenceType) |
JsonObjectValidationBuilderKey |
validationCanBeConvertedToBigDecimal()
Starts the creation of a "can be converted to a BigDecimal" validation.
|
JsonObjectValidationBuilderKey |
validationCanBeConvertedToBoolean()
Starts the creation of a "can be converted to a Boolean" validation.
|
JsonObjectValidationBuilderKey |
validationCanBeConvertedToByteArray()
Starts the creation of a "can be converted to a byte[]" validation.
|
JsonObjectValidationBuilderKey |
validationCanBeConvertedToDate()
Starts the creation of a "can be converted to a Date" validation.
|
JsonObjectValidationBuilderKey |
validationCanBeConvertedToDouble()
Starts the creation of a "can be converted to a Double" validation.
|
JsonObjectValidationBuilderKey |
validationCanBeConvertedToFloat()
Starts the creation of a "can be converted to a Float" validation.
|
JsonObjectValidationBuilderKey |
validationCanBeConvertedToInteger()
Starts the creation of a "can be converted to an Integer" validation.
|
JsonObjectValidationBuilderKey |
validationCanBeConvertedToJsonArray()
Starts the creation of a "can be converted to a JsonArray" validation.
|
JsonObjectValidationBuilderKey |
validationCanBeConvertedToJsonObject()
Starts the creation of a "can be converted to a JsonObject" validation.
|
JsonObjectValidationBuilderKey |
validationCanBeConvertedToLong()
Starts the creation of a "can be converted to a Long" validation.
|
JsonObjectValidationBuilderKey |
validationCanBeConvertedToString()
Starts the creation of a "can be converted to a String" validation.
|
JsonObjectValidationBuilderKey |
validationEmail()
Starts the creation of a "email" validation.
|
JsonObjectValidationBuilderKey |
validationEquivalent(Object reference)
Starts the creation of a "equivalent" validation.
|
JsonObjectValidationBuilderKey |
validationEquivalentOrGreater(Object reference)
Starts the creation of a "equivalent or greater" validation.
|
JsonObjectValidationBuilderKey |
validationEquivalentOrLess(Object reference)
Starts the creation of a "equivalent or less" validation.
|
JsonObjectValidationBuilderKey |
validationGreater(Object reference)
Starts the creation of a "greater than" validation.
|
JsonObjectValidationBuilderKey |
validationIsOfTypeBigDecimalOrNull()
Starts the creation of a "is of type BigDecimal or null" validation.
|
JsonObjectValidationBuilderKey |
validationIsOfTypeBooleanOrNull()
Starts the creation of a "is of type Boolean or null" validation.
|
JsonObjectValidationBuilderKey |
validationIsOfTypeByteArrayOrNull(boolean acceptBase64StringToo)
Starts the creation of a "is of type byte[] or null" validation.
|
JsonObjectValidationBuilderKey |
validationIsOfTypeDateOrNull()
Starts the creation of a "is of type Date or null" validation.
|
JsonObjectValidationBuilderKey |
validationIsOfTypeDoubleOrNull()
Starts the creation of a "is of type Double or null" validation.
|
JsonObjectValidationBuilderKey |
validationIsOfTypeFloatOrNull()
Starts the creation of a "is of type Float or null" validation.
|
JsonObjectValidationBuilderKey |
validationIsOfTypeIntegerOrNull()
Starts the creation of a "is of type Integer or null" validation.
|
JsonObjectValidationBuilderKey |
validationIsOfTypeJsonArrayOrNull()
Starts the creation of a "is of type JsonArray or null" validation.
|
JsonObjectValidationBuilderKey |
validationIsOfTypeJsonObjectOrNull()
Starts the creation of a "is of type JsonObject or null" validation.
|
JsonObjectValidationBuilderKey |
validationIsOfTypeLongOrNull()
Starts the creation of a "is of type Long or null" validation.
|
JsonObjectValidationBuilderKey |
validationIsOfTypeOrNull(Class<?> referenceType)
Starts the creation of a "is of type or null" validation.
|
JsonObjectValidationBuilderKey |
validationIsOfTypeStringOrNull()
Starts the creation of a "is of type String or null" validation.
|
JsonObjectValidationBuilderKey |
validationLength(int length)
Starts the creation of a "length" validation.
|
JsonObjectValidationBuilderKey |
validationLess(Object reference)
Starts the creation of a "less than" validation.
|
JsonObjectValidationBuilderKey |
validationMaxLength(int maxLength)
Starts the creation of a "maximum length" validation.
|
JsonObjectValidationBuilderKey |
validationMaxSize(int maxSize,
boolean ignoreNullValues)
Starts the creation of a "maximum size" validation.
|
JsonObjectValidationBuilderKey |
validationMinLength(int minLength)
Starts the creation of a "minimum length" validation.
|
JsonObjectValidationBuilderKey |
validationMinSize(int minSize,
boolean ignoreNullValues)
Starts the creation of a "minimum size" validation.
|
JsonObjectValidationBuilderKey |
validationNotBlank()
Starts the creation of a "not blank" validation.
|
JsonObjectValidationBuilderKey |
validationNotEquivalent(Object reference)
Starts the creation of a "not equivalent" validation.
|
JsonObjectValidationBuilderKey |
validationNotNull()
Starts the creation of a "not null" validation.
|
JsonObjectValidationBuilderKey |
validationNotPattern(String pattern)
Starts the creation of a "pattern must not match" validation.
|
JsonObjectValidationBuilderKey |
validationNull()
Starts the creation of a "must be null" validation.
|
JsonObjectValidationBuilderKey |
validationPattern(String pattern)
Starts the creation of a "pattern must match" validation.
|
JsonObjectValidationBuilderKey |
validationSize(int size,
boolean ignoreNullValues)
Starts the creation of a "size" validation.
|
addError, addMessage, addMessage, addMessageFormattedSpecifickey, addMessagesFormattedSpecifickeyHtml, addMessagesFormattedSpecifickeyTextPlain, addSuccess, addWarning, convertToJsonObject, createValidationSet, getArrayItselfDefaultSuccessMessageText, getArrayItselfDefaultValidationCode, getArrayItselfDefaultValidationKey, getBlankValidatorInfo, getCssClassForErrorkey, getCssClassForErrorMessage, getCssClassForSuccessMessage, getCssClassForWarningMessage, getDefaultErrorMessageText, getEmailValidatorInfo, getEquivalentOrGreaterValidator, getEquivalentOrLessValidator, getEquivalentValidator, getGreaterValidator, getJsonManager, getLengthValidator, getLessValidator, getMaxLengthValidator, getMaxSizeValidator, getMessages, getMessages, getMessagesFormatted, getMessagesFormatted, getMinLengthValidator, getMinSizeValidator, getNotBlankValidatorInfo, getNotEquivalentValidator, getNotNullValidatorInfo, getNotPatternValidator, getNullValidatorInfo, getObjectConverter, getPatternValidator, getSetItselfValidationKey, getSize, getSizeValidator, getSpincastDictionary, getValidationFactory, getXmlManager, hasMessages, hasMessages, isError, isError, isSuccess, isSuccess, isValid, isValid, isValidationDone, isWarning, isWarning, mergeValidationSet, mergeValidationSet, prefixValidationKeys, toLinkedHashMap, toMessages, toString, usePrettyJson, usePrettyXmlclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitaddError, addMessage, addMessage, addSuccess, addWarning, convertToJsonObject, createValidationSet, getMessages, getMessages, getMessagesFormatted, getMessagesFormatted, hasMessages, hasMessages, isError, isError, isSuccess, isSuccess, isValid, isValid, isWarning, isWarning, mergeValidationSet, mergeValidationSet, prefixValidationKeyspublic JsonObjectValidationSetDefault(JsonObject validatedObject, ValidationFactory validationFactory, SpincastDictionary spincastDictionary, JsonManager jsonManager, XmlManager xmlManager, ObjectConverter objectConverter)
public JsonObjectValidationSetDefault(JsonObjectOrArray validatedObject, ValidationFactory validationFactory, SpincastDictionary spincastDictionary, JsonManager jsonManager, XmlManager xmlManager, ObjectConverter objectConverter)
protected JsonObjectOrArray getValidatedObject()
protected Map<String,SimpleValidator> getIsOfTypeValidators()
protected Map<String,SimpleValidator> getCanBeConvertedToValidators()
public JsonObjectValidationBuilderKey validation(SimpleValidator validator)
ValidationSetSimpleValidator.
This is useful when you have a validator that can be reuse in different contexts (as the ones provided by Spincast).
If you need full control over a validation, the number of
generated Messages for example, then you can instead run your
validations as you wish
and use #addMessage(ValidationMessage) and other
similar methods to add the resulting validation Messages to the
set.
validation in interface JsonObjectValidationSetvalidation in interface ValidationSetvalidation in class ValidationSetDefaultpublic JsonObjectValidationBuilderKey validationNotBlank()
ValidationSetvalidationNotBlank in interface JsonObjectValidationSetvalidationNotBlank in interface ValidationSetvalidationNotBlank in class ValidationSetDefaultpublic JsonObjectValidationBuilderKey validationBlank()
ValidationSetvalidationBlank in interface JsonObjectValidationSetvalidationBlank in interface ValidationSetvalidationBlank in class ValidationSetDefaultpublic JsonObjectValidationBuilderKey validationEmail()
ValidationSetvalidationEmail in interface JsonObjectValidationSetvalidationEmail in interface ValidationSetvalidationEmail in class ValidationSetDefaultpublic JsonObjectValidationBuilderKey validationNull()
ValidationSetvalidationNull in interface JsonObjectValidationSetvalidationNull in interface ValidationSetvalidationNull in class ValidationSetDefaultpublic JsonObjectValidationBuilderKey validationNotNull()
ValidationSetvalidationNotNull in interface JsonObjectValidationSetvalidationNotNull in interface ValidationSetvalidationNotNull in class ValidationSetDefaultpublic JsonObjectValidationBuilderKey validationPattern(String pattern)
ValidationSetvalidationPattern in interface JsonObjectValidationSetvalidationPattern in interface ValidationSetvalidationPattern in class ValidationSetDefaultpublic JsonObjectValidationBuilderKey validationNotPattern(String pattern)
ValidationSetvalidationNotPattern in interface JsonObjectValidationSetvalidationNotPattern in interface ValidationSetvalidationNotPattern in class ValidationSetDefaultpublic JsonObjectValidationBuilderKey validationSize(int size, boolean ignoreNullValues)
ValidationSetvalidationSize in interface JsonObjectValidationSetvalidationSize in interface ValidationSetvalidationSize in class ValidationSetDefaultignoreNullValues - If true, null values will
be ignored in the total count. For example, if the size validation
is done on a JsonArray which is [null, null "abc"],
the size would be 3 if ignoreNullValues is false
and 1 if it's true.public JsonObjectValidationBuilderKey validationMinSize(int minSize, boolean ignoreNullValues)
ValidationSetvalidationMinSize in interface JsonObjectValidationSetvalidationMinSize in interface ValidationSetvalidationMinSize in class ValidationSetDefaultignoreNullValues - If true, null values will
be ignored in the total count. For example, if the size validation
is done on a JsonArray which is [null, null "abc"],
the size would be 3 if ignoreNullValues is false
and 1 if it's true.public JsonObjectValidationBuilderKey validationMaxSize(int maxSize, boolean ignoreNullValues)
ValidationSetvalidationMaxSize in interface JsonObjectValidationSetvalidationMaxSize in interface ValidationSetvalidationMaxSize in class ValidationSetDefaultignoreNullValues - If true, null values will
be ignored in the total count. For example, if the size validation
is done on a JsonArray which is [null, null "abc"],
the size would be 3 if ignoreNullValues is false
and 1 if it's true.public JsonObjectValidationBuilderKey validationLength(int length)
ValidationSetvalidationLength in interface JsonObjectValidationSetvalidationLength in interface ValidationSetvalidationLength in class ValidationSetDefaultpublic JsonObjectValidationBuilderKey validationMinLength(int minLength)
ValidationSet
A null value returns false, otherwise
toString() is called on the other object to
check its "length".
validationMinLength in interface JsonObjectValidationSetvalidationMinLength in interface ValidationSetvalidationMinLength in class ValidationSetDefaultpublic JsonObjectValidationBuilderKey validationMaxLength(int maxLength)
ValidationSet
A null value returns true, otherwise
toString() is called on the other object to
check its "length".
validationMaxLength in interface JsonObjectValidationSetvalidationMaxLength in interface ValidationSetvalidationMaxLength in class ValidationSetDefaultpublic JsonObjectValidationBuilderKey validationEquivalent(Object reference)
ValidationSet
To validate if an element is equivalent to another,
one is converted to the type of the other if this is required.
If this conversion fails, they are not equivalent. When both
elements are of the same types, the #equals(Object)
method is used to compre them.
The exact logic to determine if two elements are equivalent
can be found in ObjectConverter.isEquivalent(Object, Object).
validationEquivalent in interface JsonObjectValidationSetvalidationEquivalent in interface ValidationSetvalidationEquivalent in class ValidationSetDefaultpublic JsonObjectValidationBuilderKey validationNotEquivalent(Object reference)
ValidationSet
To validate if an element is equivalent to another,
one is converted to the type of the other if this is required.
If this conversion fails, they are not equivalent. When both
elements are of the same types, the #equals(Object)
method is used to compre them.
The exact logic to determine if two elements are equivalent
can be found in ObjectConverter.isEquivalent(Object, Object).
validationNotEquivalent in interface JsonObjectValidationSetvalidationNotEquivalent in interface ValidationSetvalidationNotEquivalent in class ValidationSetDefaultpublic JsonObjectValidationBuilderKey validationLess(Object reference)
ValidationSet
To validate if an element is less than another,
one is converted to the type of the other if this is required.
If this conversion fails, they can't be compared.
The resulting type must implement the Comparable interface,
so the Comparable.compareTo(Object) method is
used to compare the two elements.
null is always less than a non-null element.
validationLess in interface JsonObjectValidationSetvalidationLess in interface ValidationSetvalidationLess in class ValidationSetDefaultpublic JsonObjectValidationBuilderKey validationGreater(Object reference)
ValidationSet
To validate if an element is greater than another,
one is converted to the type of the other if this is required.
If this conversion fails, they can't be compared.
The resulting type must implement the Comparable interface,
so the Comparable.compareTo(Object) method is
used to compare the two elements.
null is always less than a non-null element.
validationGreater in interface JsonObjectValidationSetvalidationGreater in interface ValidationSetvalidationGreater in class ValidationSetDefaultpublic JsonObjectValidationBuilderKey validationEquivalentOrLess(Object reference)
ValidationSet
To validate if an element is equivalent or less than another,
one is converted to the type of the other if this is required.
If this conversion fails, they can't be compared.
The resulting type must implement the Comparable interface,
so the Comparable.compareTo(Object) method is
used to compare the two elements.
null is always less than a non-null element.
validationEquivalentOrLess in interface JsonObjectValidationSetvalidationEquivalentOrLess in interface ValidationSetvalidationEquivalentOrLess in class ValidationSetDefaultpublic JsonObjectValidationBuilderKey validationEquivalentOrGreater(Object reference)
ValidationSet
To validate if an element is equivalent or greater than another,
one is converted to the type of the other if this is required.
If this conversion fails, they can't be compared.
The resulting type must implement the Comparable interface,
so the Comparable.compareTo(Object) method is
used to compare the two elements.
null is always less than a non-null element.
validationEquivalentOrGreater in interface JsonObjectValidationSetvalidationEquivalentOrGreater in interface ValidationSetvalidationEquivalentOrGreater in class ValidationSetDefaultprotected SimpleValidator getIsOfTypeValidator(Class<?> referenceType)
public JsonObjectValidationBuilderKey validationIsOfTypeOrNull(Class<?> referenceType)
JsonObjectValidationSetvalidationIsOfTypeOrNull in interface JsonObjectValidationSetreferenceType - the type to validate agains.public JsonObjectValidationBuilderKey validationIsOfTypeStringOrNull()
JsonObjectValidationSetvalidationIsOfTypeStringOrNull in interface JsonObjectValidationSetpublic JsonObjectValidationBuilderKey validationIsOfTypeIntegerOrNull()
JsonObjectValidationSetvalidationIsOfTypeIntegerOrNull in interface JsonObjectValidationSetpublic JsonObjectValidationBuilderKey validationIsOfTypeLongOrNull()
JsonObjectValidationSetvalidationIsOfTypeLongOrNull in interface JsonObjectValidationSetpublic JsonObjectValidationBuilderKey validationIsOfTypeFloatOrNull()
JsonObjectValidationSetvalidationIsOfTypeFloatOrNull in interface JsonObjectValidationSetpublic JsonObjectValidationBuilderKey validationIsOfTypeDoubleOrNull()
JsonObjectValidationSetvalidationIsOfTypeDoubleOrNull in interface JsonObjectValidationSetpublic JsonObjectValidationBuilderKey validationIsOfTypeBooleanOrNull()
JsonObjectValidationSetvalidationIsOfTypeBooleanOrNull in interface JsonObjectValidationSetpublic JsonObjectValidationBuilderKey validationIsOfTypeBigDecimalOrNull()
JsonObjectValidationSetvalidationIsOfTypeBigDecimalOrNull in interface JsonObjectValidationSetprotected SimpleValidator getIsOfTypeByteArrayValidator(boolean acceptBase64StringToo)
public JsonObjectValidationBuilderKey validationIsOfTypeByteArrayOrNull(boolean acceptBase64StringToo)
JsonObjectValidationSetvalidationIsOfTypeByteArrayOrNull in interface JsonObjectValidationSetpublic JsonObjectValidationBuilderKey validationIsOfTypeDateOrNull()
JsonObjectValidationSetvalidationIsOfTypeDateOrNull in interface JsonObjectValidationSetpublic JsonObjectValidationBuilderKey validationIsOfTypeJsonObjectOrNull()
JsonObjectValidationSetvalidationIsOfTypeJsonObjectOrNull in interface JsonObjectValidationSetpublic JsonObjectValidationBuilderKey validationIsOfTypeJsonArrayOrNull()
JsonObjectValidationSetvalidationIsOfTypeJsonArrayOrNull in interface JsonObjectValidationSetprotected SimpleValidator getCanBeConvertedToValidator(Class<?> referenceType)
protected JsonObjectValidationBuilderKey validationCanBeConvertedTo(Class<?> referenceType)
public JsonObjectValidationBuilderKey validationCanBeConvertedToString()
JsonObjectValidationSetvalidationCanBeConvertedToString in interface JsonObjectValidationSetpublic JsonObjectValidationBuilderKey validationCanBeConvertedToInteger()
JsonObjectValidationSetvalidationCanBeConvertedToInteger in interface JsonObjectValidationSetpublic JsonObjectValidationBuilderKey validationCanBeConvertedToLong()
JsonObjectValidationSetvalidationCanBeConvertedToLong in interface JsonObjectValidationSetpublic JsonObjectValidationBuilderKey validationCanBeConvertedToFloat()
JsonObjectValidationSetvalidationCanBeConvertedToFloat in interface JsonObjectValidationSetpublic JsonObjectValidationBuilderKey validationCanBeConvertedToBoolean()
JsonObjectValidationSetvalidationCanBeConvertedToBoolean in interface JsonObjectValidationSetpublic JsonObjectValidationBuilderKey validationCanBeConvertedToDate()
JsonObjectValidationSetvalidationCanBeConvertedToDate in interface JsonObjectValidationSetpublic JsonObjectValidationBuilderKey validationCanBeConvertedToDouble()
JsonObjectValidationSetvalidationCanBeConvertedToDouble in interface JsonObjectValidationSetpublic JsonObjectValidationBuilderKey validationCanBeConvertedToBigDecimal()
JsonObjectValidationSetvalidationCanBeConvertedToBigDecimal in interface JsonObjectValidationSetpublic JsonObjectValidationBuilderKey validationCanBeConvertedToByteArray()
JsonObjectValidationSetvalidationCanBeConvertedToByteArray in interface JsonObjectValidationSetpublic JsonObjectValidationBuilderKey validationCanBeConvertedToJsonObject()
JsonObjectValidationSetvalidationCanBeConvertedToJsonObject in interface JsonObjectValidationSetpublic JsonObjectValidationBuilderKey validationCanBeConvertedToJsonArray()
JsonObjectValidationSetvalidationCanBeConvertedToJsonArray in interface JsonObjectValidationSetCopyright © 2017. All rights reserved.