Package put.ai.se.jsontools.core.format
Class JsonValidator
java.lang.Object
put.ai.se.jsontools.core.format.JsonValidator
- All Implemented Interfaces:
FormattableJson
Checks if given input is in correct JSON format.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionJsonValidator(String source) Constructs a new `JsonString` object with the provided value. -
Method Summary
Modifier and TypeMethodDescriptiongetProcessed(FormatArguments arguments) Returns the processed JSON string based on the provided format arguments.static booleanChecks whether the provided string is a valid JSON string.voidSets the value of the JSON string.
-
Field Details
-
source
-
-
Constructor Details
-
JsonValidator
Constructs a new `JsonString` object with the provided value.- Parameters:
source- The JSON string value.- Throws:
IllegalArgumentException- If the provided value is not a valid JSON string.
-
-
Method Details
-
isValid
Checks whether the provided string is a valid JSON string.- Parameters:
source- A string to be checked.- Returns:
trueif the provided string is a valid JSON string,falseotherwise.
-
setSource
Sets the value of the JSON string.- Parameters:
source- The JSON string value to be assigned.- Throws:
IllegalArgumentException- If the provided value is not a valid JSON string.
-
getProcessed
Description copied from interface:FormattableJsonReturns the processed JSON string based on the provided format arguments.- Specified by:
getProcessedin interfaceFormattableJson- Parameters:
arguments- The format arguments.- Returns:
- The processed JSON string.
-