I had a short look at the text.translate package. One thing I noticed is
that the classes NumericEntityEscaper and UnicodeEscaper (both derived
from CodePointTranslator) have some duplicate code, especially for
defining the code points that should be processed.
Maybe this can be extracted to a common location, e.g. by defining a
CodePointConfiguration class (or whatever name you prefer) which
contains the logic of selecting the code points to process. We could
even use our Range class here to define an arbitrary number of intervals
to be processed by the translator. The concrete translator classes are
then created passing in such a configuration object.
Alternatively a builder approach could be used; the builder could define
methods corresponding to the already existing static factory methods in
the concrete CodePointTranslator subclasses plus the following ones:
Builder addRange(Range<Integer> range);
CodePointTranslator buildNumericEntityEscaper();
CodePointTranslator buildUnicodeEscaper();
Just a suggestion.
Oliver
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org