public final class ParameterHelper extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
ParameterHelper.ParameterType
Enumeration of supported types
|
| Modifier and Type | Field and Description |
|---|---|
private static DateTimeFormatter |
__ISO_OFFSET_DATE_TIME
The ISO date-time formatter that formats or parses a date-time with an offset, such as '2011-12-03T10:15:30.000+01:00'.
|
private static Logger |
_logger |
| Modifier | Constructor and Description |
|---|---|
private |
ParameterHelper() |
| Modifier and Type | Method and Description |
|---|---|
private static void |
_saxConfigurationObject(ContentHandler handler,
String name,
Object value) |
static Object |
castValue(String value,
ParameterHelper.ParameterType type)
Cast a untyped value (string) to an object of the type
|
static DateTimeFormatter |
getISODateTimeFormatter()
Get the ISO date-time formatter that formats or parses a date-time with an offset, such as '2011-12-03T10:15:30.000+01:00'.
|
static ParameterHelper.ParameterType |
stringToType(String type)
Convert a string containing a type to its value
|
static Map<String,Object> |
toJSON(Parameter parameter)
Convert the parameter in a JSON map
|
static void |
toSAXEnumerator(ContentHandler handler,
Enumerator enumerator)
SAX parameter enumerator
|
static void |
toSAXParameter(ContentHandler handler,
Parameter parameter,
Object value)
SAX a parameter
|
static void |
toSAXParameterInternal(ContentHandler handler,
Parameter parameter,
Object value)
SAX a parameter except the root tag
|
static void |
toSAXValidator(ContentHandler handler,
Validator validator)
SAX parameter validator
|
static String |
typeToString(ParameterHelper.ParameterType type)
Return the readable name of a type
|
static String |
valueToString(Object value)
Converts known types to string
|
private static DateTimeFormatter __ISO_OFFSET_DATE_TIME
private ParameterHelper()
public static DateTimeFormatter getISODateTimeFormatter()
DateTimeFormatter.ISO_OFFSET_DATE_TIME but force 3-digits milliseconds.public static String typeToString(ParameterHelper.ParameterType type)
type - Type to convertIllegalArgumentException - If the type is unknwonpublic static ParameterHelper.ParameterType stringToType(String type)
type - Name of the typeIllegalArgumentException - if the type is unknownpublic static Object castValue(String value, ParameterHelper.ParameterType type)
value - Value to casttype - Type to cast value inpublic static String valueToString(Object value)
value - Typed valueIllegalArgumentException - if the object is a InputStreampublic static void toSAXParameter(ContentHandler handler, Parameter parameter, Object value) throws SAXException, ProcessingException
handler - The content handler where to SAXparameter - The parameter to SAXvalue - The parameter value. Can be null.SAXException - If an error occurred while SAXingProcessingException - If an error occurredpublic static void toSAXParameterInternal(ContentHandler handler, Parameter parameter, Object value) throws SAXException, ProcessingException
handler - The content handler where to SAXparameter - The parameter to SAXvalue - The parameter value. Can be null.SAXException - If an error occurred while SAXingProcessingException - If an error occurredpublic static void toSAXEnumerator(ContentHandler handler, Enumerator enumerator) throws SAXException, ProcessingException
handler - The content handler where to SAXenumerator - The enumerator to SAXSAXException - If an error occurred to SAXProcessingException - If an error occurredpublic static void toSAXValidator(ContentHandler handler, Validator validator) throws SAXException
handler - The content handler where to SAXvalidator - The validator to SAXSAXException - If an error occurred while SAXingprivate static void _saxConfigurationObject(ContentHandler handler, String name, Object value) throws SAXException
SAXExceptionpublic static Map<String,Object> toJSON(Parameter parameter) throws ProcessingException
parameter - The parameter to convertProcessingException - If an error occured when converting the parameter