Package com.ilib
Class PluralFormHelper
- java.lang.Object
-
- com.ilib.PluralFormHelper
-
public class PluralFormHelper extends java.lang.Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
PluralFormHelper.PluralRule
-
Field Summary
Fields Modifier and Type Field Description protected static java.util.regex.Pattern
commandParser
protected java.util.Map<java.lang.String,java.lang.String>
forms
static java.io.File
pluralsJSON
static java.io.File
root
protected static java.lang.String
VALUE_REPLACER
-
Constructor Summary
Constructors Constructor Description PluralFormHelper(java.lang.String localeSpec)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Map<java.lang.String,java.lang.String>
getForms()
static java.util.Map<java.lang.String,java.lang.String>
getPluralForms(java.io.InputStream is)
<K> java.lang.String
getPluralKey(int value)
static <K> java.lang.String
getPluralKey(int value, java.util.Map<java.lang.String,K> plurals)
protected static boolean
inrange(int actual, int leftRange, int rightRange)
protected static java.lang.String
invokeFunction(java.lang.String methodName, java.lang.String[] params)
protected static void
matchPluralForm(java.lang.StringBuilder builder)
protected static boolean
notin(int actual, int leftRange, int rightRange)
protected static void
scanJsonParts(java.lang.Object jsonPart, PluralFormHelper.PluralRule call)
-
-
-
Field Detail
-
root
public static final java.io.File root
-
pluralsJSON
public static final java.io.File pluralsJSON
-
commandParser
protected static final java.util.regex.Pattern commandParser
-
VALUE_REPLACER
protected static final java.lang.String VALUE_REPLACER
- See Also:
- Constant Field Values
-
forms
protected java.util.Map<java.lang.String,java.lang.String> forms
-
-
Method Detail
-
getForms
public java.util.Map<java.lang.String,java.lang.String> getForms()
-
getPluralKey
public <K> java.lang.String getPluralKey(int value)
-
getPluralForms
public static java.util.Map<java.lang.String,java.lang.String> getPluralForms(java.io.InputStream is)
- Parameters:
file
-- Returns:
- a map containing the plural forms encoded in the file
-
getPluralKey
public static <K> java.lang.String getPluralKey(int value, java.util.Map<java.lang.String,K> plurals)
- Parameters:
value
-plurals
-- Returns:
- the key for a value in the plurals map
-
scanJsonParts
protected static void scanJsonParts(java.lang.Object jsonPart, PluralFormHelper.PluralRule call) throws org.json.JSONException
- Throws:
org.json.JSONException
-
matchPluralForm
protected static void matchPluralForm(java.lang.StringBuilder builder)
-
invokeFunction
protected static java.lang.String invokeFunction(java.lang.String methodName, java.lang.String[] params)
-
inrange
protected static boolean inrange(int actual, int leftRange, int rightRange)
-
notin
protected static boolean notin(int actual, int leftRange, int rightRange)
-
-