@Test public void testGroupName() { assertEquals("MASTER", MetricsUtil.getGroupName(Master.class)); assertEquals("MASTER", MetricsUtil.getGroupName(Master.Cluster.class)); assertEquals("MASTER", MetricsUtil.getGroupName(Master.Cluster.ACTIVE_NODES)); }
public static String getGroupName(Class clazz) { checkMetricsClass(clazz); String [] names = pattern.split(clazz.getCanonicalName().substring(24)); if (names.length > 0) { return names[0].toUpperCase(); } else { if (clazz.isEnum()) { return clazz.getSimpleName().toUpperCase(); } else { throw new RuntimeException("Invalid Metrics Class: " + clazz.getName()); } } }
MetricsUtil { public static String getGroupName(Class clazz) { checkMetricsClass(clazz); String [] names = pattern.split(clazz.getCanonicalName().substring(24)); if (names.length > 0) { return names[0].toUpperCase(); } else { if (clazz.isEnum()) { return clazz.getSimpleName().toUpperCase(); } else { throw new RuntimeException("Invalid Metrics Class: " + clazz.getName()); } } } }
MetricsUtil { public static String getGroupName(Class clazz) { checkMetricsClass(clazz); String [] names = pattern.split(clazz.getCanonicalName().substring(24)); if (names.length > 0) { return names[0].toUpperCase(); } else { if (clazz.isEnum()) { return clazz.getSimpleName().toUpperCase(); } else { throw new RuntimeException("Invalid Metrics Class: " + clazz.getName()); } } }  }
MetricsUtil { public static String getGroupName(Class clazz) { checkMetricsClass(clazz); String [] names = pattern.split(clazz.getCanonicalName().substring(24)); if (names.length > 0) { return names[0].toUpperCase(); } else { if (clazz.isEnum()) { return clazz.getSimpleName().toUpperCase(); } else { throw new RuntimeException("Invalid Metrics Class: " + clazz.getName()); } } }  static String getGroupName(Class clazz); static String getGroupName(Enum<?> e); static String getCanonicalContextName(Class<? extends Enum<?>> clazz); static String getContextName(Class<? extends Enum<?>> clazz); static String getCanonicalName(Enum<?> e); static String getSimpleName(Enum<?> e); }
MetricsUtil { public static String getGroupName(Class clazz) { checkMetricsClass(clazz); String [] names = pattern.split(clazz.getCanonicalName().substring(24)); if (names.length > 0) { return names[0].toUpperCase(); } else { if (clazz.isEnum()) { return clazz.getSimpleName().toUpperCase(); } else { throw new RuntimeException("Invalid Metrics Class: " + clazz.getName()); } } }  static String getGroupName(Class clazz); static String getGroupName(Enum<?> e); static String getCanonicalContextName(Class<? extends Enum<?>> clazz); static String getContextName(Class<? extends Enum<?>> clazz); static String getCanonicalName(Enum<?> e); static String getSimpleName(Enum<?> e); static final String DELIMITER; }