Package com.networknt.schema.format
Class PatternFormat
- java.lang.Object
-
- com.networknt.schema.format.PatternFormat
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.StringerrorMessageDescriptionprivate java.lang.StringmessageKeyprivate java.lang.Stringnameprivate java.util.regex.Patternpattern
-
Constructor Summary
Constructors Modifier Constructor Description PatternFormat(java.lang.String name, java.lang.String regex, java.lang.String errorMessageDescription)Deprecated.privatePatternFormat(java.lang.String name, java.lang.String regex, java.lang.String errorMessageDescription, java.lang.String messageKey)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetErrorMessageDescription()Gets the error message description.java.lang.StringgetMessageKey()Gets the message key to use for the message.java.lang.StringgetName()Gets the format name.booleanmatches(ExecutionContext executionContext, java.lang.String value)Determines if the value matches the format.static PatternFormatof(java.lang.String name, java.lang.String regex, java.lang.String messageKey)Creates a pattern format.
-
-
-
Constructor Detail
-
PatternFormat
@Deprecated public PatternFormat(java.lang.String name, java.lang.String regex, java.lang.String errorMessageDescription)Deprecated.Constructor.Use
of(String, String, String)instead.- Parameters:
name- the nameregex- the regexerrorMessageDescription- the error message description
-
PatternFormat
private PatternFormat(java.lang.String name, java.lang.String regex, java.lang.String errorMessageDescription, java.lang.String messageKey)
-
-
Method Detail
-
of
public static PatternFormat of(java.lang.String name, java.lang.String regex, java.lang.String messageKey)
Creates a pattern format.- Parameters:
name- the nameregex- the regex patternmessageKey- the message key- Returns:
- the pattern format
-
matches
public boolean matches(ExecutionContext executionContext, java.lang.String value)
Description copied from interface:FormatDetermines if the value matches the format.This should be implemented for string node types.
-
getName
public java.lang.String getName()
Description copied from interface:FormatGets the format name.
-
getMessageKey
public java.lang.String getMessageKey()
Description copied from interface:FormatGets the message key to use for the message.See jsv-messages.properties.
The following are the arguments.
{0} The instance location
{1} The format name
{2} The error message description
{3} The input value- Specified by:
getMessageKeyin interfaceFormat- Returns:
- the message key
-
getErrorMessageDescription
public java.lang.String getErrorMessageDescription()
Description copied from interface:FormatGets the error message description.Deprecated. Override getMessageKey() and set the localized message in the resource bundle or message source.
- Specified by:
getErrorMessageDescriptionin interfaceFormat- Returns:
- the error message description.
-
-