commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bay...@apache.org
Subject svn commit: r828944 - /commons/proper/lang/trunk/src/java/org/apache/commons/lang/text/translate/UnicodeEscaper.java
Date Fri, 23 Oct 2009 06:46:02 GMT
Author: bayard
Date: Fri Oct 23 06:46:02 2009
New Revision: 828944

URL: http://svn.apache.org/viewvc?rev=828944&view=rev
Log:
Making the private fields final via Sebb's patch from LANG-540

Modified:
    commons/proper/lang/trunk/src/java/org/apache/commons/lang/text/translate/UnicodeEscaper.java

Modified: commons/proper/lang/trunk/src/java/org/apache/commons/lang/text/translate/UnicodeEscaper.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/java/org/apache/commons/lang/text/translate/UnicodeEscaper.java?rev=828944&r1=828943&r2=828944&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/java/org/apache/commons/lang/text/translate/UnicodeEscaper.java
(original)
+++ commons/proper/lang/trunk/src/java/org/apache/commons/lang/text/translate/UnicodeEscaper.java
Fri Oct 23 06:46:02 2009
@@ -25,9 +25,19 @@
  */
 public class UnicodeEscaper 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;
+
+    public UnicodeEscaper(){
+        this(0, Integer.MAX_VALUE, true);
+    }
+
+    private UnicodeEscaper(int below, int above, boolean between) {
+        this.below = below;
+        this.above = above;
+        this.between = between;
+    }
 
     public static UnicodeEscaper below(int codepoint) {
         return outsideOf(codepoint, Integer.MAX_VALUE);
@@ -38,17 +48,12 @@
     }
 
     public static UnicodeEscaper outsideOf(int codepointLow, int codepointHigh) {
-        UnicodeEscaper escaper = new UnicodeEscaper();
-        escaper.above = codepointHigh;
-        escaper.below = codepointLow;
-        escaper.between = false;
+        UnicodeEscaper escaper = new UnicodeEscaper(codepointLow, codepointHigh, false);
         return escaper;
     }
 
     public static UnicodeEscaper between(int codepointLow, int codepointHigh) {
-        UnicodeEscaper escaper = new UnicodeEscaper();
-        escaper.above = codepointHigh;
-        escaper.below = codepointLow;
+        UnicodeEscaper escaper = new UnicodeEscaper(codepointLow, codepointHigh, true);
         return escaper;
     }
 



Mime
View raw message