public class MetricNamingUtil extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
REPLACEMENT_CHAR |
static String |
SEPARATOR |
| Modifier and Type | Method and Description |
|---|---|
static String |
join(String[] nameParts)
Joins an array of strings into a composite name.
|
static String |
join(String topLevelName,
String... additionalNames)
Joins the passed in strings into a composite name.
|
static String |
sanitize(String valueStr)
Sanitizes the input string by trimming it and replacing illegal characters with
REPLACEMENT_CHAR. |
public static final String REPLACEMENT_CHAR
public static final String SEPARATOR
public static String sanitize(String valueStr)
REPLACEMENT_CHAR. An illegal character is any character but "\w" and "-". That is,
this method does not allow the separator (SEPARATOR) character.valueStr - the string to sanitize.public static String join(String[] nameParts)
REPLACEMENT_CHAR. An illegal character is any
character but "\w", "-", and SEPARATOR.nameParts - array of strings to combine into a composite name.NullPointerException - if the passed in array is null.IllegalArgumentException - if the passed in array is empty.public static String join(String topLevelName, String... additionalNames)
REPLACEMENT_CHAR. An illegal character is any
character but "\w", "-", and SEPARATOR.topLevelName - top-level part of the name.additionalNames - additional parts of the name.IllegalArgumentException - if top-level part of the name is blank.Copyright © 2016–2018. All rights reserved.