@Test public void testIdIndexIncrements() throws Exception { final int COUNT = 5; ArrayList<String> ids = new ArrayList<String>(COUNT); ArrayList<Integer> sequences = new ArrayList<Integer>(); for (int i = 0; i < COUNT; ++i) { ids.add(generator.generateId()); } for (String id : ids) { String[] components = id.split(":"); sequences.add(Integer.parseInt(components[components.length - 1])); } Integer lastValue = null; for (Integer sequence : sequences) { if (lastValue != null) { assertTrue(sequence > lastValue); } lastValue = sequence; } }
public String generateId() { StringBuilder sb = new StringBuilder(64); sb.append(prefix); sb.append(UUID.randomUUID()); sb.append(":"); sb.append(sequence.getAndIncrement()); return sb.toString(); }
IdGenerator { public String generateId() { StringBuilder sb = new StringBuilder(64); sb.append(prefix); sb.append(UUID.randomUUID()); sb.append(":"); sb.append(sequence.getAndIncrement()); return sb.toString(); } }
IdGenerator { public String generateId() { StringBuilder sb = new StringBuilder(64); sb.append(prefix); sb.append(UUID.randomUUID()); sb.append(":"); sb.append(sequence.getAndIncrement()); return sb.toString(); } IdGenerator(String prefix);  IdGenerator(); }
IdGenerator { public String generateId() { StringBuilder sb = new StringBuilder(64); sb.append(prefix); sb.append(UUID.randomUUID()); sb.append(":"); sb.append(sequence.getAndIncrement()); return sb.toString(); } IdGenerator(String prefix);  IdGenerator(); String generateId(); }
IdGenerator { public String generateId() { StringBuilder sb = new StringBuilder(64); sb.append(prefix); sb.append(UUID.randomUUID()); sb.append(":"); sb.append(sequence.getAndIncrement()); return sb.toString(); } IdGenerator(String prefix);  IdGenerator(); String generateId(); static final String DEFAULT_PREFIX; static final String PROPERTY_IDGENERATOR_HOST_PREFIX; }