@Test public void testGenerateRoutingKeyServer() { RoutingKey id = RoutingKey .forName("com.cinchapi.concourse.server.http.IndexRouter"); Assert.assertEquals("com.cinchapi", id.group); Assert.assertEquals("server", id.module); Assert.assertEquals("IndexRouter", id.cls); }
public static RoutingKey forName(String name) { String group = null; String module = null; String cls = null; StringSplitter it = new StringSplitter(name, '.'); String previous = null; String next = null; while (it.hasNext()) { previous = next; next = it.next(); if(group == null) { group = next; } else if(group.equals("com") || group.equals("org") || group.equals("net")) { group += '.' + next; } else if(module == null) { if(next != null && (next.equals("concourse") || (next.equals("router") && previous != null && previous.equals("concourse")))) { continue; } else { module = next; } } else { cls = next; } } return new RoutingKey(group, module, cls); }
RoutingKey { public static RoutingKey forName(String name) { String group = null; String module = null; String cls = null; StringSplitter it = new StringSplitter(name, '.'); String previous = null; String next = null; while (it.hasNext()) { previous = next; next = it.next(); if(group == null) { group = next; } else if(group.equals("com") || group.equals("org") || group.equals("net")) { group += '.' + next; } else if(module == null) { if(next != null && (next.equals("concourse") || (next.equals("router") && previous != null && previous.equals("concourse")))) { continue; } else { module = next; } } else { cls = next; } } return new RoutingKey(group, module, cls); } }
RoutingKey { public static RoutingKey forName(String name) { String group = null; String module = null; String cls = null; StringSplitter it = new StringSplitter(name, '.'); String previous = null; String next = null; while (it.hasNext()) { previous = next; next = it.next(); if(group == null) { group = next; } else if(group.equals("com") || group.equals("org") || group.equals("net")) { group += '.' + next; } else if(module == null) { if(next != null && (next.equals("concourse") || (next.equals("router") && previous != null && previous.equals("concourse")))) { continue; } else { module = next; } } else { cls = next; } } return new RoutingKey(group, module, cls); } private  RoutingKey(String group, String module, String cls); }
RoutingKey { public static RoutingKey forName(String name) { String group = null; String module = null; String cls = null; StringSplitter it = new StringSplitter(name, '.'); String previous = null; String next = null; while (it.hasNext()) { previous = next; next = it.next(); if(group == null) { group = next; } else if(group.equals("com") || group.equals("org") || group.equals("net")) { group += '.' + next; } else if(module == null) { if(next != null && (next.equals("concourse") || (next.equals("router") && previous != null && previous.equals("concourse")))) { continue; } else { module = next; } } else { cls = next; } } return new RoutingKey(group, module, cls); } private  RoutingKey(String group, String module, String cls); static RoutingKey forName(String name); static RoutingKey forClass(Class<?> clazz); @Override String toString(); }
RoutingKey { public static RoutingKey forName(String name) { String group = null; String module = null; String cls = null; StringSplitter it = new StringSplitter(name, '.'); String previous = null; String next = null; while (it.hasNext()) { previous = next; next = it.next(); if(group == null) { group = next; } else if(group.equals("com") || group.equals("org") || group.equals("net")) { group += '.' + next; } else if(module == null) { if(next != null && (next.equals("concourse") || (next.equals("router") && previous != null && previous.equals("concourse")))) { continue; } else { module = next; } } else { cls = next; } } return new RoutingKey(group, module, cls); } private  RoutingKey(String group, String module, String cls); static RoutingKey forName(String name); static RoutingKey forClass(Class<?> clazz); @Override String toString(); final String group; final String module; final String cls; }