
com.automationrockstars.gunter.IdUtils Maven / Gradle / Ivy
The newest version!
/*
*
*/
package com.automationrockstars.gunter;
import com.google.common.base.Strings;
import java.text.SimpleDateFormat;
import java.util.Date;
public class IdUtils {
private static SimpleDateFormat formatter = new SimpleDateFormat("dd.HH:mm:ss");
public static final String id(EventType type) {
return String.format("%s-%s", type, postfix());
}
public static final String id(String parent, EventType type) {
return String.format("%s-%s-%s", parent, type, postfix());
}
private static synchronized final String postfix() {
return formatter.format(new Date()) + Strings.padEnd(String.valueOf(System.nanoTime()), 12, '0').substring(12);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy