Package com.networknt.schema.utils
Class RFC5892
- java.lang.Object
-
- com.networknt.schema.utils.RFC5892
-
public class RFC5892 extends java.lang.Object
Encapsulates the rules determining whether a label conforms to the RFC 5892 specification.In the context of RFC 5892. a label is a subcomponent of a DNS entry. For example, schema.networknt.com has three sub-components or labels: com, networknt and schema.
Each component (or label) must satisfy the constraints identified in RFC 5892.
-
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.String
ACE_PREFIX
private static int
ACE_PREFIX_LENGTH
private static java.util.function.BiPredicate<java.lang.String,java.lang.Integer>
ALLOWED_CHARACTER
private static java.util.BitSet
CONTEXTJ
private static java.util.BitSet
CONTEXTO
private static java.util.BitSet
DISALLOWED
private static int
GREEK_LOWER_NUMERAL_SIGN
private static int
HEBREW_GERESH
private static int
HEBREW_GERSHAYIM
private static java.util.function.BiPredicate<java.lang.String,java.lang.Integer>
IDNA_RULES
private static int
KATAKANA_MIDDLE_DOT
private static java.util.function.BiPredicate<java.lang.String,java.lang.Integer>
LTR
private static int
MIDDLE_DOT
private static java.util.function.BiPredicate<java.lang.String,java.lang.Integer>
RTL
private static java.util.function.BiPredicate<java.lang.String,java.lang.Integer>
RULE_ARABIC_INDIC_DIGITS_RULE
private static java.util.function.BiPredicate<java.lang.String,java.lang.Integer>
RULE_EXTENDED_ARABIC_INDIC_DIGITS_RULE
private static java.util.function.BiPredicate<java.lang.String,java.lang.Integer>
RULE_GREEK_LOWER_NUMERAL_SIGN
private static java.util.function.BiPredicate<java.lang.String,java.lang.Integer>
RULE_HEBREW_GERESH_GERSHAYIM
private static java.util.function.BiPredicate<java.lang.String,java.lang.Integer>
RULE_KATAKANA_MIDDLE_DOT
private static java.util.function.BiPredicate<java.lang.String,java.lang.Integer>
RULE_MIDDLE_DOT
private static java.util.function.BiPredicate<java.lang.String,java.lang.Integer>
RULE_ZERO_WIDTH_JOINER
private static java.util.function.BiPredicate<java.lang.String,java.lang.Integer>
RULE_ZERO_WIDTH_NON_JOINER
private static java.util.BitSet
UNASSIGNED
private static int
VIRAMA
private static int
ZERO_WIDTH_JOINER
private static int
ZERO_WIDTH_NON_JOINER
-
Constructor Summary
Constructors Constructor Description RFC5892()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description private static boolean
isACE(java.lang.String value)
private static boolean
isCombiningMark(int codepoint)
private static boolean
isContextJ(int codepoint)
private static boolean
isContextO(int codepoint)
private static boolean
isDisallowed(int codepoint)
private static boolean
isUnassigned(int codepoint)
static boolean
isValid(java.lang.String value)
private static void
loadDerivedProperties()
private static boolean
testAllowedCharacter(java.lang.String s, int i)
private static boolean
testArabicIndicDigit(java.lang.String s, int i)
private static boolean
testeMiddleDotRule(java.lang.String s, int i)
Determines whether the MIDDLE DOT conforms to the RFC 5892 specification.private static boolean
testExtendedArabicIndicDigit(java.lang.String s, int i)
private static boolean
testGreekLowerNumeralSign(java.lang.String s, int i)
Determines whether the GREEK LOWER NUMERAL SIGN (KERAIA) conforms to the RFC 5892 specification.private static boolean
testHebrewPuncuation(java.lang.String s, int i)
Determines whether the HEBREW PUNCTUATION (GERESH or GERSHAYIM) conforms to the RFC 5892 specification.private static boolean
testKatakanaMiddleDot(java.lang.String s, int i)
Determines whether the KATAKANA MIDDLE DOT conforms to the RFC 5892 specification.private static boolean
testLTR(java.lang.String s, int i)
private static boolean
testRTL(java.lang.String s, int i)
private static boolean
testZeroWidthJoiner(java.lang.String s, int i)
Determines whether the ZERO WIDTH JOINER conforms to the RFC 5892 specification.private static boolean
testZeroWidthNonJoiner(java.lang.String s, int i)
Determines whether the ZERO WIDTH NON-OINER conforms to the RFC 5892 specification.
-
-
-
Field Detail
-
ACE_PREFIX
private static final java.lang.String ACE_PREFIX
- See Also:
- Constant Field Values
-
ACE_PREFIX_LENGTH
private static final int ACE_PREFIX_LENGTH
-
GREEK_LOWER_NUMERAL_SIGN
private static final int GREEK_LOWER_NUMERAL_SIGN
- See Also:
- Constant Field Values
-
HEBREW_GERESH
private static final int HEBREW_GERESH
- See Also:
- Constant Field Values
-
HEBREW_GERSHAYIM
private static final int HEBREW_GERSHAYIM
- See Also:
- Constant Field Values
-
KATAKANA_MIDDLE_DOT
private static final int KATAKANA_MIDDLE_DOT
- See Also:
- Constant Field Values
-
MIDDLE_DOT
private static final int MIDDLE_DOT
- See Also:
- Constant Field Values
-
VIRAMA
private static final int VIRAMA
- See Also:
- Constant Field Values
-
ZERO_WIDTH_JOINER
private static final int ZERO_WIDTH_JOINER
- See Also:
- Constant Field Values
-
ZERO_WIDTH_NON_JOINER
private static final int ZERO_WIDTH_NON_JOINER
- See Also:
- Constant Field Values
-
CONTEXTJ
private static final java.util.BitSet CONTEXTJ
-
CONTEXTO
private static final java.util.BitSet CONTEXTO
-
DISALLOWED
private static final java.util.BitSet DISALLOWED
-
UNASSIGNED
private static final java.util.BitSet UNASSIGNED
-
RULE_ARABIC_INDIC_DIGITS_RULE
private static java.util.function.BiPredicate<java.lang.String,java.lang.Integer> RULE_ARABIC_INDIC_DIGITS_RULE
-
RULE_EXTENDED_ARABIC_INDIC_DIGITS_RULE
private static java.util.function.BiPredicate<java.lang.String,java.lang.Integer> RULE_EXTENDED_ARABIC_INDIC_DIGITS_RULE
-
RULE_GREEK_LOWER_NUMERAL_SIGN
private static java.util.function.BiPredicate<java.lang.String,java.lang.Integer> RULE_GREEK_LOWER_NUMERAL_SIGN
-
RULE_HEBREW_GERESH_GERSHAYIM
private static java.util.function.BiPredicate<java.lang.String,java.lang.Integer> RULE_HEBREW_GERESH_GERSHAYIM
-
RULE_KATAKANA_MIDDLE_DOT
private static java.util.function.BiPredicate<java.lang.String,java.lang.Integer> RULE_KATAKANA_MIDDLE_DOT
-
RULE_MIDDLE_DOT
private static java.util.function.BiPredicate<java.lang.String,java.lang.Integer> RULE_MIDDLE_DOT
-
RULE_ZERO_WIDTH_JOINER
private static java.util.function.BiPredicate<java.lang.String,java.lang.Integer> RULE_ZERO_WIDTH_JOINER
-
RULE_ZERO_WIDTH_NON_JOINER
private static java.util.function.BiPredicate<java.lang.String,java.lang.Integer> RULE_ZERO_WIDTH_NON_JOINER
-
ALLOWED_CHARACTER
private static java.util.function.BiPredicate<java.lang.String,java.lang.Integer> ALLOWED_CHARACTER
-
LTR
private static java.util.function.BiPredicate<java.lang.String,java.lang.Integer> LTR
-
RTL
private static java.util.function.BiPredicate<java.lang.String,java.lang.Integer> RTL
-
IDNA_RULES
private static java.util.function.BiPredicate<java.lang.String,java.lang.Integer> IDNA_RULES
-
-
Method Detail
-
isContextJ
private static boolean isContextJ(int codepoint)
-
isContextO
private static boolean isContextO(int codepoint)
-
isDisallowed
private static boolean isDisallowed(int codepoint)
-
isUnassigned
private static boolean isUnassigned(int codepoint)
-
testAllowedCharacter
private static boolean testAllowedCharacter(java.lang.String s, int i)
-
isValid
public static boolean isValid(java.lang.String value)
-
isACE
private static boolean isACE(java.lang.String value)
-
isCombiningMark
private static boolean isCombiningMark(int codepoint)
-
testLTR
private static boolean testLTR(java.lang.String s, int i)
-
testRTL
private static boolean testRTL(java.lang.String s, int i)
-
testGreekLowerNumeralSign
private static boolean testGreekLowerNumeralSign(java.lang.String s, int i)
Determines whether the GREEK LOWER NUMERAL SIGN (KERAIA) conforms to the RFC 5892 specification.- Parameters:
s
- Must be a simple Unicode string; i.e., not ACE encodedi
- the location of the KERAIA within the source label- Returns:
true
if the KERAIA rule is valid at the given location or the character at the given position is not the KERAIA character.
-
testHebrewPuncuation
private static boolean testHebrewPuncuation(java.lang.String s, int i)
Determines whether the HEBREW PUNCTUATION (GERESH or GERSHAYIM) conforms to the RFC 5892 specification.- Parameters:
s
- Must be a simple Unicode string; i.e., not ACE encodedi
- the location of the character within the source label- Returns:
true
if the rule is valid at the given location or the character at the given position is not a GERESH or GERSHAYIM character.
-
testKatakanaMiddleDot
private static boolean testKatakanaMiddleDot(java.lang.String s, int i)
Determines whether the KATAKANA MIDDLE DOT conforms to the RFC 5892 specification.- Parameters:
s
- Must be a simple Unicode string; i.e., not ACE encodedi
- the location of the character within the source label- Returns:
true
if the rule is valid at the given location or the character at the given position is not a KATAKANA MIDDLE DOT character.
-
testeMiddleDotRule
private static boolean testeMiddleDotRule(java.lang.String s, int i)
Determines whether the MIDDLE DOT conforms to the RFC 5892 specification.- Parameters:
s
- Must be a simple Unicode string; i.e., not ACE encodedi
- the location of the MIDDLE DOT within the source label- Returns:
true
if the MIDDLE DOT rule is valid at the given location or the character at the given position is not the MIDDLE DOT character.
-
testZeroWidthJoiner
private static boolean testZeroWidthJoiner(java.lang.String s, int i)
Determines whether the ZERO WIDTH JOINER conforms to the RFC 5892 specification.- Parameters:
s
- Must be a simple Unicode string; i.e., not ACE encodedi
- the location of the character within the source label- Returns:
true
if the rule is valid at the given location or the character at the given position is not a ZERO WIDTH JOINER character.
-
testZeroWidthNonJoiner
private static boolean testZeroWidthNonJoiner(java.lang.String s, int i)
Determines whether the ZERO WIDTH NON-OINER conforms to the RFC 5892 specification.- Parameters:
s
- Must be a simple Unicode string; i.e., not ACE encodedi
- the location of the character within the source label- Returns:
true
if the rule is valid at the given location or the character at the given position is not a ZERO WIDTH NON-JOINER character.
-
testArabicIndicDigit
private static boolean testArabicIndicDigit(java.lang.String s, int i)
-
testExtendedArabicIndicDigit
private static boolean testExtendedArabicIndicDigit(java.lang.String s, int i)
-
loadDerivedProperties
private static void loadDerivedProperties()
-
-