From ba0205c20243c8e92ee4fec91d1549c6a6d94611 Mon Sep 17 00:00:00 2001 From: Henri Yandell Date: Fri, 23 Oct 2009 06:46:02 +0000 Subject: [PATCH] Making the private fields final via Sebb's patch from LANG-540 git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@828944 13f79535-47bb-0310-9956-ffa450edef68 --- .../lang/text/translate/UnicodeEscaper.java | 25 +++++++++++-------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/src/java/org/apache/commons/lang/text/translate/UnicodeEscaper.java b/src/java/org/apache/commons/lang/text/translate/UnicodeEscaper.java index 3ea3f183d..0cbec532e 100644 --- a/src/java/org/apache/commons/lang/text/translate/UnicodeEscaper.java +++ b/src/java/org/apache/commons/lang/text/translate/UnicodeEscaper.java @@ -25,9 +25,19 @@ import java.io.Writer; */ 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 class UnicodeEscaper extends CodePointTranslator { } 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; }