public class VObjectValidator extends Object
Checks properties for illegal characters.
Two kinds of checking are supported: strict and non-strict. Strict ensures that the data adhere to the specifications. Non-strict allows all characters to be used, as long as they do not break the syntax.
Example:
SyntaxStyle style = SyntaxStyle.NEW; String name = "NOTE #2"; boolean strict = false; assertTrue(VObjectValidator.validatePropertyName(name, style, strict)); strict = true; assertFalse(VObjectValidator.validatePropertyName(name, style, strict));
| Modifier and Type | Method and Description |
|---|---|
static AllowedCharacters |
allowedCharactersGroup(SyntaxStyle syntax,
boolean strict)
Gets the list of allowed characters for group names.
|
static AllowedCharacters |
allowedCharactersParameterName(SyntaxStyle syntax,
boolean strict)
Gets the list of allowed characters for parameter names.
|
static AllowedCharacters |
allowedCharactersParameterValue(SyntaxStyle syntax,
boolean caretEncoding,
boolean strict)
Gets the list of allowed characters for parameter values.
|
static AllowedCharacters |
allowedCharactersPropertyName(SyntaxStyle syntax,
boolean strict)
Gets the list of allowed characters for property names.
|
static boolean |
validateGroupName(String group,
SyntaxStyle syntax,
boolean strict)
Validates a group name.
|
static boolean |
validateParameterName(String name,
SyntaxStyle syntax,
boolean strict)
Validates a parameter name.
|
static boolean |
validateParameterValue(String value,
SyntaxStyle syntax,
boolean caretEncoding,
boolean strict)
Validates a parameter value.
|
static boolean |
validatePropertyName(String name,
SyntaxStyle syntax,
boolean strict)
Validates a property name.
|
public static boolean validatePropertyName(String name, SyntaxStyle syntax, boolean strict)
name - the property namesyntax - the syntax style to validate againststrict - false to allow all characters as long as they don't break
the syntax, true for spec-compliant validationpublic static AllowedCharacters allowedCharactersPropertyName(SyntaxStyle syntax, boolean strict)
syntax - the syntax stylestrict - false for the non-strict list, true for the spec-compliant
listpublic static boolean validateGroupName(String group, SyntaxStyle syntax, boolean strict)
group - the group namesyntax - the syntax style to validate againststrict - false to allow all characters as long as they don't break
the syntax, true for spec-compliant validationpublic static AllowedCharacters allowedCharactersGroup(SyntaxStyle syntax, boolean strict)
syntax - the syntax stylestrict - false for the non-strict list, true for the spec-compliant
listpublic static boolean validateParameterName(String name, SyntaxStyle syntax, boolean strict)
name - the parameter namesyntax - the syntax style to validate againststrict - false to allow all characters as long as they don't break
the syntax, true for spec-compliant validationpublic static AllowedCharacters allowedCharactersParameterName(SyntaxStyle syntax, boolean strict)
syntax - the syntax stylestrict - false for the non-strict list, true for the spec-compliant
listpublic static boolean validateParameterValue(String value, SyntaxStyle syntax, boolean caretEncoding, boolean strict)
value - the parameter valuesyntax - the syntax style to validate againstcaretEncoding - true if caret encoding is enabled, false if notstrict - false to allow all characters as long as they don't break
the syntax, true for spec-compliant validationpublic static AllowedCharacters allowedCharactersParameterValue(SyntaxStyle syntax, boolean caretEncoding, boolean strict)
syntax - the syntax stylecaretEncoding - true if caret encoding is enabled, false if notstrict - false for the non-strict list, true for the spec-compliant
listCopyright © 2016–2018 Michael Angstadt. All rights reserved.