All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.github.pleuvoir.rabbit.utils.Generator Maven / Gradle / Ivy

There is a newer version: 1.0.6
Show newest version
package io.github.pleuvoir.rabbit.utils;

import org.apache.commons.lang3.StringUtils;

import com.fasterxml.uuid.EthernetAddress;
import com.fasterxml.uuid.Generators;
import com.fasterxml.uuid.impl.TimeBasedGenerator;

/**
 * 生成uuid并去掉 "-"
 * 
 */
public class Generator {
	
	private static final String HORIZONTAL = "-";

	private static TimeBasedGenerator timeBasedGenerator;

	static {
		timeBasedGenerator = Generators.timeBasedGenerator(EthernetAddress.fromInterface());
	}

	/**
	 * 生成下一个UUID
	 */
	public static String nextUUID() {
		return timeBasedGenerator.generate().toString().replace(HORIZONTAL, StringUtils.EMPTY);
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy