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)
| 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() { |