Class RegexMarkerDictionary.Builder

  • Enclosing class:
    RegexMarkerDictionary

    public static class RegexMarkerDictionary.Builder
    extends Object
    Provides a builder for creating RegexMarkerDictionary objects.
    • Constructor Detail

      • Builder

        public Builder()
        Creates a new builder. Note that, for the resulting object to function, at least one pattern must be added.
    • Method Detail

      • addPattern

        public RegexMarkerDictionary.Builder addPattern​(String regex,
                                                        Marker matching)
        Adds a pattern to the builder. The regular expression provided is tested using find(), meaning that if the string must match exactly, \A and \z must be used at the beginning and end of the expression respectively.
        Parameters:
        regex - the regular expression
        matching - the matching marker, that is to say the marker to return when the regex matches.
        Returns:
        returns this object
      • addPattern

        public RegexMarkerDictionary.Builder addPattern​(String regex,
                                                        Marker matching,
                                                        Marker nonMatching)
        Adds a pattern to the builder. The regular expression provided is tested using find(), meaning that if the string must match exactly, \A and \z must be used at the beginning and end of the expression respectively.
        Parameters:
        regex - the regular expression
        matching - the matching marker, that is to say the marker to return when the regex matches.
        nonMatching - the non-matching marker, that is to say the marker to return if the regex doesn't match
        Returns:
        returns this object
      • build

        public RegexMarkerDictionary build()
        Builds this builder.
        Returns:
        returns a new RegexMarkerDictionary