diff options
Diffstat (limited to 'projects/net.wotonomy.web/src/main/java/net/wotonomy/web/WOResourceManager.java')
| -rw-r--r-- | projects/net.wotonomy.web/src/main/java/net/wotonomy/web/WOResourceManager.java | 40 |
1 files changed, 15 insertions, 25 deletions
diff --git a/projects/net.wotonomy.web/src/main/java/net/wotonomy/web/WOResourceManager.java b/projects/net.wotonomy.web/src/main/java/net/wotonomy/web/WOResourceManager.java index 5941ad2..170af3b 100644 --- a/projects/net.wotonomy.web/src/main/java/net/wotonomy/web/WOResourceManager.java +++ b/projects/net.wotonomy.web/src/main/java/net/wotonomy/web/WOResourceManager.java @@ -44,20 +44,20 @@ import net.wotonomy.foundation.internal.PropertyListParser; * @version $Revision: 905 $ */ public class WOResourceManager { - private NSMutableDictionary resourceCache; - private NSMutableDictionary dynamicDataCache; - private NSMutableDictionary stringTableCache; - private Map localeCache; // used for wo-style i18n + private NSMutableDictionary<String, Object> resourceCache; + private NSMutableDictionary<String, TypedData> dynamicDataCache; + private NSMutableDictionary<String, Object> stringTableCache; + private Map<String, Locale> localeCache; // used for wo-style i18n private Locale californiaLocale; // used for wo-style i18n /** * Constructor is only accessible to subclasses. */ protected WOResourceManager() { - resourceCache = new NSMutableDictionary(); - dynamicDataCache = new NSMutableDictionary(); - stringTableCache = new NSMutableDictionary(); - localeCache = new HashMap(); + resourceCache = new NSMutableDictionary<>(); + dynamicDataCache = new NSMutableDictionary<>(); + stringTableCache = new NSMutableDictionary<>(); + localeCache = new HashMap<>(); californiaLocale = new Locale("en", "US"); localeCache.put("en", californiaLocale); } @@ -67,7 +67,7 @@ public class WOResourceManager { * retrieved by this method will be placed in the resource manager's global * cache. */ - public byte[] bytesForResourceNamed(String aFileName, String aFrameworkName, NSArray aLanguagesList) { + public byte[] bytesForResourceNamed(String aFileName, String aFrameworkName, NSArray<Locale> aLanguagesList) { String mash = aFileName + aFrameworkName; if (aLanguagesList != null) { mash = mash + aLanguagesList.componentsJoinedByString(":"); @@ -153,7 +153,7 @@ public class WOResourceManager { * * @deprecated Use inputStreamForResourceNamed instead. */ - public String pathForResourceNamed(String aResourceName, String aFrameworkName, NSArray aLanguagesList) { + public String pathForResourceNamed(String aResourceName, String aFrameworkName, NSArray<Locale> aLanguagesList) { throw new RuntimeException("ResourceManager.pathForResourceNamed: deprecated"); } @@ -196,7 +196,7 @@ public class WOResourceManager { * doesn't exist, aDefaultValue is returned. */ public String stringForKey(String aKey, String aFileName, String aDefaultValue, String aFrameworkName, - NSArray aLanguagesList) { + NSArray<Locale> aLanguagesList) { String mash = aFileName + aFrameworkName; if (aLanguagesList != null) { @@ -241,7 +241,7 @@ public class WOResourceManager { /** * Returns a url that invokes the resource manager for the specified resource. */ - public String urlForResourceNamed(String aResourceName, String aFrameworkName, NSArray aLanguagesList, + public String urlForResourceNamed(String aResourceName, String aFrameworkName, NSArray<Locale> aLanguagesList, WORequest aRequest) { StringBuffer buffer = new StringBuffer(); if (aFrameworkName == null) { @@ -264,7 +264,7 @@ public class WOResourceManager { * be put in the resource manager's global cache. */ public InputStream inputStreamForResourceNamed(String aResourceName, String aFrameworkName, - NSArray aLanguagesList) { + NSArray<Locale> aLanguagesList) { if (aResourceName == null) return null; InputStream result = null; @@ -285,8 +285,8 @@ public class WOResourceManager { if (aLanguagesList != null) { String language; Locale locale; - HashSet tried = new HashSet(5); - Enumeration e = aLanguagesList.objectEnumerator(); + HashSet<String> tried = new HashSet<>(5); + Enumeration<Locale> e = aLanguagesList.objectEnumerator(); while (e.hasMoreElements() && result == null) { language = e.nextElement().toString(); @@ -349,16 +349,6 @@ public class WOResourceManager { } return input; } - - private static final class TypedData { - String type; - NSData data; - - public TypedData(String aType, NSData aData) { - type = aType; - data = aData; - } - } } /* |
