public final class TextUtils extends Object
Modifier and Type | Method and Description |
---|---|
static <T> T |
convertViaJSON(Object value,
Class<T> clazz) |
static String |
joinDelimited(Iterable<?> elements,
char delimiter) |
static String |
joinJSON(Iterable<?> elements) |
static String |
joinPMMLDelimited(Iterable<?> elements) |
static String |
joinPMMLDelimitedNumbers(Iterable<? extends Number> elements) |
static String[] |
parseDelimited(String delimited,
char delimiter) |
static String[] |
parseJSONArray(String json) |
static String[] |
parsePMMLDelimited(String delimited) |
static <T> T |
readJSON(String json,
Class<T> clazz) |
public static String[] parseDelimited(String delimited, char delimiter)
delimited
- line of delimited textdelimiter
- delimiter to split fields onpublic static String[] parsePMMLDelimited(String delimited)
delimited
- PMML-style space-delimited value stringpublic static String joinDelimited(Iterable<?> elements, char delimiter)
elements
- values to join by the delimiter to make one line of textdelimiter
- delimiter to put between fieldspublic static String joinPMMLDelimited(Iterable<?> elements)
elements
- values to join by space to make one line of textpublic static String joinPMMLDelimitedNumbers(Iterable<? extends Number> elements)
elements
- numbers to join by space to make one line of textpublic static String[] parseJSONArray(String json) throws IOException
json
- line of JSON textIOException
- if JSON parsing failspublic static String joinJSON(Iterable<?> elements)
elements
- elements to be joined in a JSON string. May be any objects.public static <T> T readJSON(String json, Class<T> clazz)
T
- type that should be parsed from JSON and returnedjson
- JSON stringclazz
- Java type to interpret aspublic static <T> T convertViaJSON(Object value, Class<T> clazz)
T
- type that should be parsed from JSON and returnedvalue
- value to convertclazz
- desired type to interpret asCopyright © 2014–2018. All rights reserved.