public class Utils extends java.lang.Object
Constructor and Description |
---|
Utils() |
Modifier and Type | Method and Description |
---|---|
static java.lang.Object |
convertStringValueIntoProperType(java.lang.Object originalValue,
java.util.HashMap<java.lang.String,java.lang.String[]> params,
int index,
java.lang.String htmlElementID)
Converts a String value into the type/class of originalValue.
|
static java.lang.String |
getHTMLElementIDFromString(java.lang.String input)
Based on a input String, returns a valid HTML element name or ID for it.
|
static java.lang.String |
getHTMLInputFromType(java.lang.String id,
java.lang.Object value)
Based on the "real" type/class of the plugin setting Object returns the appropriate form input for it.
|
static java.lang.String |
getHTMLInputFromType(java.lang.String name,
java.lang.Object value,
boolean isArrayElement)
Based on the "real" type/class of the plugin setting Object returns the appropriate form input for it.
|
static boolean |
parseCheckBoxValue(java.lang.String value)
Given the string value of a checkbox obtained from an http request,
returns its boolean value.
|
static boolean |
parseCheckBoxValue(java.lang.String[] values,
int index)
Given the string value of a checkbox obtained from an http request,
returns its boolean value.
|
static java.util.HashMap<java.lang.String,java.lang.Object> |
processAdvancedSettings(java.util.HashMap<java.lang.String,java.lang.Object> originalSettings,
java.util.HashMap<java.lang.String,java.lang.String[]> newSettings)
This converts and applies the new textual values into the originalSettings HashMap, taking into account their original class/type.
|
public Utils()
public static java.util.HashMap<java.lang.String,java.lang.Object> processAdvancedSettings(java.util.HashMap<java.lang.String,java.lang.Object> originalSettings, java.util.HashMap<java.lang.String,java.lang.String[]> newSettings)
originalSettings
- the original advanced/internal settings of a plugin or service.newSettings
- the new settings to apply.public static boolean parseCheckBoxValue(java.lang.String value)
value
- the checkbox value obtained from an http request.public static boolean parseCheckBoxValue(java.lang.String[] values, int index)
values
- an array of Strings where the checkbox value obtained from an http request is.index
- the index on the array where the wanted checkbox value is.public static java.lang.String getHTMLElementIDFromString(java.lang.String input)
input
- the input String.public static java.lang.String getHTMLInputFromType(java.lang.String name, java.lang.Object value, boolean isArrayElement)
name
- the Form Name of this HTML input.value
- a Object.isArrayElement
- if this value Object is part of a another multiple value Object.public static java.lang.String getHTMLInputFromType(java.lang.String id, java.lang.Object value)
id
- the ID and Name of this HTML input.value
- a Object.public static java.lang.Object convertStringValueIntoProperType(java.lang.Object originalValue, java.util.HashMap<java.lang.String,java.lang.String[]> params, int index, java.lang.String htmlElementID)
originalValue
- the original/target type/class of the value.newValue
- the new value in String form.