MCPcopy Index your code
hub / github.com/OpenTSDB/opentsdb / stringToType

Method stringToType

src/tree/TreeRule.java:478–494  ·  view source on GitHub ↗

Parses a string into a rule type enumerator @param type The string to parse @return The type enumerator @throws IllegalArgumentException if the type was empty or invalid

(final String type)

Source from the content-addressed store, hash-verified

476 * @throws IllegalArgumentException if the type was empty or invalid
477 */
478 public static TreeRuleType stringToType(final String type) {
479 if (type == null || type.isEmpty()) {
480 throw new IllegalArgumentException("Rule type was empty");
481 } else if (type.toLowerCase().equals("metric")) {
482 return TreeRuleType.METRIC;
483 } else if (type.toLowerCase().equals("metric_custom")) {
484 return TreeRuleType.METRIC_CUSTOM;
485 } else if (type.toLowerCase().equals("tagk")) {
486 return TreeRuleType.TAGK;
487 } else if (type.toLowerCase().equals("tagk_custom")) {
488 return TreeRuleType.TAGK_CUSTOM;
489 } else if (type.toLowerCase().equals("tagv_custom")) {
490 return TreeRuleType.TAGV_CUSTOM;
491 } else {
492 throw new IllegalArgumentException("Unrecognized rule type");
493 }
494 }
495
496 /** @return The configured rule column prefix */
497 public static byte[] RULE_PREFIX() {

Callers 10

stringToTypeMetricMethod · 0.95
stringToTypeTagkMethod · 0.95
stringToTypeNullMethod · 0.95
stringToTypeEmptyMethod · 0.95
stringToTypeInvalidMethod · 0.95
deserializeMethod · 0.95
parseRuleMethod · 0.95

Calls 2

isEmptyMethod · 0.80
equalsMethod · 0.45

Tested by 8

stringToTypeMetricMethod · 0.76
stringToTypeTagkMethod · 0.76
stringToTypeNullMethod · 0.76
stringToTypeEmptyMethod · 0.76
stringToTypeInvalidMethod · 0.76