Class 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.

    • 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.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • 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
      • 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 final java.util.function.BiPredicate<java.lang.String,​java.lang.Integer> RULE_ARABIC_INDIC_DIGITS_RULE
      • RULE_EXTENDED_ARABIC_INDIC_DIGITS_RULE

        private static final java.util.function.BiPredicate<java.lang.String,​java.lang.Integer> RULE_EXTENDED_ARABIC_INDIC_DIGITS_RULE
      • RULE_GREEK_LOWER_NUMERAL_SIGN

        private static final java.util.function.BiPredicate<java.lang.String,​java.lang.Integer> RULE_GREEK_LOWER_NUMERAL_SIGN
      • RULE_HEBREW_GERESH_GERSHAYIM

        private static final java.util.function.BiPredicate<java.lang.String,​java.lang.Integer> RULE_HEBREW_GERESH_GERSHAYIM
      • RULE_KATAKANA_MIDDLE_DOT

        private static final java.util.function.BiPredicate<java.lang.String,​java.lang.Integer> RULE_KATAKANA_MIDDLE_DOT
      • RULE_MIDDLE_DOT

        private static final java.util.function.BiPredicate<java.lang.String,​java.lang.Integer> RULE_MIDDLE_DOT
      • RULE_ZERO_WIDTH_JOINER

        private static final java.util.function.BiPredicate<java.lang.String,​java.lang.Integer> RULE_ZERO_WIDTH_JOINER
      • RULE_ZERO_WIDTH_NON_JOINER

        private static final java.util.function.BiPredicate<java.lang.String,​java.lang.Integer> RULE_ZERO_WIDTH_NON_JOINER
      • ALLOWED_CHARACTER

        private static final java.util.function.BiPredicate<java.lang.String,​java.lang.Integer> ALLOWED_CHARACTER
      • LTR

        private static final java.util.function.BiPredicate<java.lang.String,​java.lang.Integer> LTR
      • RTL

        private static final java.util.function.BiPredicate<java.lang.String,​java.lang.Integer> RTL
      • IDNA_RULES

        private static final java.util.function.BiPredicate<java.lang.String,​java.lang.Integer> IDNA_RULES
    • Constructor Detail

      • RFC5892

        public RFC5892()
    • 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 encoded
        i - 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 encoded
        i - 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 encoded
        i - 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 encoded
        i - 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 encoded
        i - 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 encoded
        i - 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()