Package org.daisy.dotify.translator
Class RegexMarkerDictionary.Builder
- java.lang.Object
-
- org.daisy.dotify.translator.RegexMarkerDictionary.Builder
-
- Enclosing class:
- RegexMarkerDictionary
public static class RegexMarkerDictionary.Builder extends Object
Provides a builder for creating RegexMarkerDictionary objects.
-
-
Constructor Summary
Constructors Constructor Description Builder()
Creates a new builder.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description RegexMarkerDictionary.Builder
addPattern(String regex, Marker matching)
Adds a pattern to the builder.RegexMarkerDictionary.Builder
addPattern(String regex, Marker matching, Marker nonMatching)
Adds a pattern to the builder.RegexMarkerDictionary
build()
Builds this builder.RegexMarkerDictionary.Builder
filter(TextAttributeFilter filter)
Sets a text attribute filter.
-
-
-
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 expressionmatching
- 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 expressionmatching
- 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
-
filter
public RegexMarkerDictionary.Builder filter(TextAttributeFilter filter)
Sets a text attribute filter.- Parameters:
filter
- the filter- Returns:
- returns this builder
-
build
public RegexMarkerDictionary build()
Builds this builder.- Returns:
- returns a new RegexMarkerDictionary
-
-