diff options
author | PJ Fanning <fanningpj@apache.org> | 2024-10-15 16:33:15 +0000 |
---|---|---|
committer | PJ Fanning <fanningpj@apache.org> | 2024-10-15 16:33:15 +0000 |
commit | 822974aadc69be4482b710505fae4b220eecf29c (patch) | |
tree | 0af6e4f7059a57f38a19c563b67dbca4631be29d /poi-ooxml | |
parent | c5986447d18d6bb3a06f5a31888a244355c963ac (diff) | |
download | poi-822974aadc69be4482b710505fae4b220eecf29c.tar.gz poi-822974aadc69be4482b710505fae4b220eecf29c.zip |
make static maps final
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1921340 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'poi-ooxml')
6 files changed, 26 insertions, 11 deletions
diff --git a/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/Borders.java b/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/Borders.java index 2ab27d37da..6b08e0ee25 100644 --- a/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/Borders.java +++ b/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/Borders.java @@ -604,7 +604,7 @@ public enum Borders { static { final Map<Integer, Borders> tempMap = new HashMap<>(); for (Borders p : values()) { - tempMap.put(Integer.valueOf(p.getValue()), p); + tempMap.put(p.getValue(), p); } imap = Collections.unmodifiableMap(tempMap); } diff --git a/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/BreakType.java b/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/BreakType.java index f86a89e25f..5eaebd9b68 100644 --- a/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/BreakType.java +++ b/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/BreakType.java @@ -16,6 +16,7 @@ ==================================================================== */ package org.apache.poi.xwpf.usermodel; +import java.util.Collections; import java.util.HashMap; import java.util.Map; @@ -54,12 +55,14 @@ public enum BreakType { */ TEXT_WRAPPING(3); - private static Map<Integer, BreakType> imap = new HashMap<>(); + private static final Map<Integer, BreakType> imap; static { + final Map<Integer, BreakType> tempMap = new HashMap<>(); for (BreakType p : values()) { - imap.put(p.getValue(), p); + tempMap.put(p.getValue(), p); } + imap = Collections.unmodifiableMap(tempMap); } private final int value; diff --git a/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/LineSpacingRule.java b/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/LineSpacingRule.java index b8b6fbde71..4b9cb9804e 100644 --- a/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/LineSpacingRule.java +++ b/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/LineSpacingRule.java @@ -16,6 +16,7 @@ ==================================================================== */ package org.apache.poi.xwpf.usermodel; +import java.util.Collections; import java.util.HashMap; import java.util.Map; @@ -47,12 +48,14 @@ public enum LineSpacingRule { AT_LEAST(3); - private static Map<Integer, LineSpacingRule> imap = new HashMap<>(); + private static final Map<Integer, LineSpacingRule> imap; static { + final Map<Integer, LineSpacingRule> tempMap = new HashMap<>(); for (LineSpacingRule p : values()) { - imap.put(p.getValue(), p); + tempMap.put(p.getValue(), p); } + imap = Collections.unmodifiableMap(tempMap); } private final int value; diff --git a/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/TableRowAlign.java b/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/TableRowAlign.java index 35e80d33b1..06653cdb33 100644 --- a/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/TableRowAlign.java +++ b/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/TableRowAlign.java @@ -18,6 +18,7 @@ package org.apache.poi.xwpf.usermodel; import org.openxmlformats.schemas.wordprocessingml.x2006.main.STJcTable; +import java.util.Collections; import java.util.HashMap; import java.util.Map; @@ -30,12 +31,14 @@ public enum TableRowAlign { CENTER(STJcTable.INT_CENTER), RIGHT(STJcTable.INT_END); - private static Map<Integer, TableRowAlign> imap = new HashMap<>(); + private static final Map<Integer, TableRowAlign> imap; static { + final Map<Integer, TableRowAlign> tempMap = new HashMap<>(); for (TableRowAlign p : values()) { - imap.put(p.getValue(), p); + tempMap.put(p.getValue(), p); } + imap = Collections.unmodifiableMap(tempMap); } private final int value; diff --git a/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/TableRowHeightRule.java b/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/TableRowHeightRule.java index 2a42c76baf..cbe41afc6e 100644 --- a/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/TableRowHeightRule.java +++ b/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/TableRowHeightRule.java @@ -16,6 +16,7 @@ ==================================================================== */ package org.apache.poi.xwpf.usermodel; +import java.util.Collections; import java.util.HashMap; import java.util.Map; @@ -28,12 +29,14 @@ public enum TableRowHeightRule { EXACT(2), AT_LEAST(3); - private static Map<Integer, TableRowHeightRule> imap = new HashMap<>(); + private static final Map<Integer, TableRowHeightRule> imap; static { + final Map<Integer, TableRowHeightRule> tempMap = new HashMap<>(); for (TableRowHeightRule p : values()) { - imap.put(p.getValue(), p); + tempMap.put(p.getValue(), p); } + imap = Collections.unmodifiableMap(tempMap); } private final int value; diff --git a/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/TextAlignment.java b/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/TextAlignment.java index 3fb8231589..97d9e3cd53 100644 --- a/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/TextAlignment.java +++ b/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/TextAlignment.java @@ -16,6 +16,7 @@ ==================================================================== */ package org.apache.poi.xwpf.usermodel; +import java.util.Collections; import java.util.HashMap; import java.util.Map; @@ -50,12 +51,14 @@ public enum TextAlignment { */ AUTO(5); - private static Map<Integer, TextAlignment> imap = new HashMap<>(); + private static final Map<Integer, TextAlignment> imap; static { + final Map<Integer, TextAlignment> tempMap = new HashMap<>(); for (TextAlignment p : values()) { - imap.put(p.getValue(), p); + tempMap.put(p.getValue(), p); } + imap = Collections.unmodifiableMap(tempMap); } private final int value; |