Package org.apache.myfaces.util
Class WebConfigParamUtils
java.lang.Object
org.apache.myfaces.util.WebConfigParamUtils
Utility class to handle web config parameters
- Since:
- 2.0.10 (4.0.4 in shared, 1.0.1 in commons)
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionstatic booleangetBooleanInitParameter(ExternalContext context, String name) Gets the boolean init parameter value from the specified context.static booleangetBooleanInitParameter(ExternalContext context, String[] names) Gets the boolean init parameter value from the specified context.static booleangetBooleanInitParameter(ExternalContext context, String[] names, boolean defaultValue) Gets the boolean init parameter value from the specified context.static booleangetBooleanInitParameter(ExternalContext context, String[] names, boolean defaultValue, String[] valuesIgnoreCase, boolean returnOnValueEqualsIgnoreCase) Gets the boolean init parameter value from the specified context.static booleangetBooleanInitParameter(ExternalContext context, String name, boolean defaultValue) Gets the boolean init parameter value from the specified context.static booleangetBooleanInitParameter(ExternalContext context, String name, boolean defaultValue, String[] valuesIgnoreCase, boolean returnOnValueEqualsIgnoreCase) Gets the boolean init parameter value from the specified context.static <T> TgetInstanceInitParameter(ExternalContext context, String name, String deprecatedName, T defaultValue) Gets the init parameter value from the specified context and instanciate it.static intgetIntegerInitParameter(ExternalContext context, String name) Gets the int init parameter value from the specified context.static intgetIntegerInitParameter(ExternalContext context, String[] names) Gets the int init parameter value from the specified context.static intgetIntegerInitParameter(ExternalContext context, String[] names, int defaultValue) Gets the int init parameter value from the specified context.static intgetIntegerInitParameter(ExternalContext context, String name, int defaultValue) Gets the int init parameter value from the specified context.static longgetLongInitParameter(ExternalContext context, String name) Gets the long init parameter value from the specified context.static longgetLongInitParameter(ExternalContext context, String[] names) Gets the long init parameter value from the specified context.static longgetLongInitParameter(ExternalContext context, String[] names, long defaultValue) Gets the long init parameter value from the specified context.static longgetLongInitParameter(ExternalContext context, String name, long defaultValue) Gets the long init parameter value from the specified context.static StringgetStringInitParameter(ExternalContext context, String name) Gets the String init parameter value from the specified context.static StringgetStringInitParameter(ExternalContext context, String[] names) Gets the String init parameter value from the specified context.static StringgetStringInitParameter(ExternalContext context, String[] names, String defaultValue) Gets the String init parameter value from the specified context.static StringgetStringInitParameter(ExternalContext context, String name, String defaultValue) Gets the String init parameter value from the specified context.
- 
Constructor Details- 
WebConfigParamUtilspublic WebConfigParamUtils()
 
- 
- 
Method Details- 
getStringInitParameterGets the String init parameter value from the specified context. If the parameter is an empty String or a String containing only white space, this method returnsnull- Parameters:
- context- the application's external context
- name- the init parameter's name
- Returns:
- the parameter if it was specified and was not empty, nullotherwise
- Throws:
- NullPointerException- if context or name is- null
 
- 
getStringInitParameterpublic static String getStringInitParameter(ExternalContext context, String name, String defaultValue) Gets the String init parameter value from the specified context. If the parameter is an empty String or a String containing only white space, this method returnsnull- Parameters:
- context- the application's external context
- name- the init parameter's name
- defaultValue- the value by default if null or empty
- Returns:
- the parameter if it was specified and was not empty, nullotherwise
- Throws:
- NullPointerException- if context or name is- null
 
- 
getStringInitParameterGets the String init parameter value from the specified context. If the parameter is an empty String or a String containing only white space, this method returnsnull- Parameters:
- context- the application's external context
- names- the init parameter's names, the first one is scanned first. Usually used when a param has multiple aliases
- Returns:
- the parameter if it was specified and was not empty, nullotherwise
- Throws:
- NullPointerException- if context or name is- null
 
- 
getStringInitParameterpublic static String getStringInitParameter(ExternalContext context, String[] names, String defaultValue) Gets the String init parameter value from the specified context. If the parameter is an empty String or a String containing only white space, this method returnsnull- Parameters:
- context- the application's external context
- names- the init parameter's names, the first one is scanned first. Usually used when a param has multiple aliases
- defaultValue- the value by default if null or empty
- Returns:
- the parameter if it was specified and was not empty, nullotherwise
- Throws:
- NullPointerException- if context or name is- null
 
- 
getBooleanInitParameterGets the boolean init parameter value from the specified context. If the parameter was not specified, the default value is used instead.- Parameters:
- context- the application's external context
- name- the init parameter's name
- Returns:
- the init parameter value as a boolean
- Throws:
- NullPointerException- if context or name is- null
 
- 
getBooleanInitParameterpublic static boolean getBooleanInitParameter(ExternalContext context, String name, boolean defaultValue) Gets the boolean init parameter value from the specified context. If the parameter was not specified, the default value is used instead.- Parameters:
- context- the application's external context
- name- the init parameter's name
- defaultValue- the default value to return in case the parameter was not set
- Returns:
- the init parameter value as a boolean
- Throws:
- NullPointerException- if context or name is- null
 
- 
getBooleanInitParameterpublic static boolean getBooleanInitParameter(ExternalContext context, String name, boolean defaultValue, String[] valuesIgnoreCase, boolean returnOnValueEqualsIgnoreCase) Gets the boolean init parameter value from the specified context. If the parameter was not specified, the default value is used instead.- Parameters:
- context- the application's external context
- name- the init parameter's name
- defaultValue- the default value to return in case the parameter was not set
- valuesIgnoreCase- an array of valid values to match
- returnOnValueEqualsIgnoreCase- the value to return in case the parameter match with valuesIgnoreCase
- Returns:
- the init parameter value as a boolean
- Throws:
- NullPointerException- if context or name is- null
 
- 
getBooleanInitParameterGets the boolean init parameter value from the specified context. If the parameter was not specified, the default value is used instead.- Parameters:
- context- the application's external context
- names- the init parameter's names
- Returns:
- the init parameter value as a boolean
- Throws:
- NullPointerException- if context or name is- null
 
- 
getBooleanInitParameterpublic static boolean getBooleanInitParameter(ExternalContext context, String[] names, boolean defaultValue) Gets the boolean init parameter value from the specified context. If the parameter was not specified, the default value is used instead.- Parameters:
- context- the application's external context
- names- the init parameter's names
- defaultValue- the default value to return in case the parameter was not set
- Returns:
- the init parameter value as a boolean
- Throws:
- NullPointerException- if context or name is- null
 
- 
getBooleanInitParameterpublic static boolean getBooleanInitParameter(ExternalContext context, String[] names, boolean defaultValue, String[] valuesIgnoreCase, boolean returnOnValueEqualsIgnoreCase) Gets the boolean init parameter value from the specified context. If the parameter was not specified, the default value is used instead.- Parameters:
- context- the application's external context
- names- the init parameter's names
- defaultValue- the default value to return in case the parameter was not set
- valuesIgnoreCase- an array of valid values to match
- returnOnValueEqualsIgnoreCase- the value to return in case the parameter match with valuesIgnoreCase
- Returns:
- the init parameter value as a boolean
- Throws:
- NullPointerException- if context or name is- null
 
- 
getIntegerInitParameterGets the int init parameter value from the specified context. If the parameter was not specified, the default value is used instead.- Parameters:
- context- the application's external context
- name- the init parameter's name
- Returns:
- the init parameter value as a int
- Throws:
- NullPointerException- if context or name is- null
 
- 
getIntegerInitParameterGets the int init parameter value from the specified context. If the parameter was not specified, the default value is used instead.- Parameters:
- context- the application's external context
- name- the init parameter's name
- defaultValue- the default value to return in case the parameter was not set
- Returns:
- the init parameter value as a int
- Throws:
- NullPointerException- if context or name is- null
 
- 
getIntegerInitParameterGets the int init parameter value from the specified context. If the parameter was not specified, the default value is used instead.- Parameters:
- context- the application's external context
- names- the init parameter's names
- Returns:
- the init parameter value as a int
- Throws:
- NullPointerException- if context or name is- null
 
- 
getIntegerInitParameterpublic static int getIntegerInitParameter(ExternalContext context, String[] names, int defaultValue) Gets the int init parameter value from the specified context. If the parameter was not specified, the default value is used instead.- Parameters:
- context- the application's external context
- names- the init parameter's names
- defaultValue- the default value to return in case the parameter was not set
- Returns:
- the init parameter value as a int
- Throws:
- NullPointerException- if context or name is- null
 
- 
getLongInitParameterGets the long init parameter value from the specified context. If the parameter was not specified, the default value is used instead.- Parameters:
- context- the application's external context
- name- the init parameter's name
- Returns:
- the init parameter value as a long
- Throws:
- NullPointerException- if context or name is- null
 
- 
getLongInitParameterGets the long init parameter value from the specified context. If the parameter was not specified, the default value is used instead.- Parameters:
- context- the application's external context
- name- the init parameter's name
- defaultValue- the default value to return in case the parameter was not set
- Returns:
- the init parameter value as a long
- Throws:
- NullPointerException- if context or name is- null
 
- 
getLongInitParameterGets the long init parameter value from the specified context. If the parameter was not specified, the default value is used instead.- Parameters:
- context- the application's external context
- names- the init parameter's names
- Returns:
- the init parameter value as a long
- Throws:
- NullPointerException- if context or name is- null
 
- 
getLongInitParameterGets the long init parameter value from the specified context. If the parameter was not specified, the default value is used instead.- Parameters:
- context- the application's external context
- names- the init parameter's names
- defaultValue- the default value to return in case the parameter was not set
- Returns:
- the init parameter value as a long
- Throws:
- NullPointerException- if context or name is- null
 
- 
getInstanceInitParameterpublic static <T> T getInstanceInitParameter(ExternalContext context, String name, String deprecatedName, T defaultValue) Gets the init parameter value from the specified context and instanciate it. If the parameter was not specified, the default value is used instead.- Parameters:
- context- the application's external context
- name- the init parameter's name
- deprecatedName- the init parameter's deprecated name.
- defaultValue- the default value to return in case the parameter was not set
- Returns:
- the init parameter value as an object instance
- Throws:
- NullPointerException- if context or name is- null
 
 
-