You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ba...@apache.org on 2009/10/20 06:19:48 UTC
svn commit: r826947 -
/commons/proper/lang/trunk/src/java/org/apache/commons/lang/text/translate/NumericEntityEscaper.java
Author: bayard
Date: Tue Oct 20 04:19:47 2009
New Revision: 826947
URL: http://svn.apache.org/viewvc?rev=826947&view=rev
Log:
Applying Sebb's patch from LANG-540 making the NumericEntityEscaper class immutable
Modified:
commons/proper/lang/trunk/src/java/org/apache/commons/lang/text/translate/NumericEntityEscaper.java
Modified: commons/proper/lang/trunk/src/java/org/apache/commons/lang/text/translate/NumericEntityEscaper.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/java/org/apache/commons/lang/text/translate/NumericEntityEscaper.java?rev=826947&r1=826946&r2=826947&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/java/org/apache/commons/lang/text/translate/NumericEntityEscaper.java (original)
+++ commons/proper/lang/trunk/src/java/org/apache/commons/lang/text/translate/NumericEntityEscaper.java Tue Oct 20 04:19:47 2009
@@ -25,9 +25,15 @@
*/
public class NumericEntityEscaper extends CodePointTranslator {
- private int below = 0;
- private int above = Integer.MAX_VALUE;
- private boolean between = true;
+ private final int below;
+ private final int above;
+ private final boolean between;
+
+ private NumericEntityEscaper(int below, int above, boolean between) {
+ this.below = below;
+ this.above = above;
+ this.between = between;
+ }
public static NumericEntityEscaper below(int codepoint) {
return outsideOf(codepoint, Integer.MAX_VALUE);
@@ -38,18 +44,11 @@
}
public static NumericEntityEscaper between(int codepointLow, int codepointHigh) {
- NumericEntityEscaper escaper = new NumericEntityEscaper();
- escaper.above = codepointHigh;
- escaper.below = codepointLow;
- return escaper;
+ return new NumericEntityEscaper(codepointLow, codepointHigh, true);
}
public static NumericEntityEscaper outsideOf(int codepointLow, int codepointHigh) {
- NumericEntityEscaper escaper = new NumericEntityEscaper();
- escaper.above = codepointHigh;
- escaper.below = codepointLow;
- escaper.between = false;
- return escaper;
+ return new NumericEntityEscaper(codepointLow, codepointHigh, false);
}
/**