ref[id]: rename IdUtils to UuidUtils

This commit is contained in:
godotg
2023-09-02 21:00:52 +08:00
parent 00ac69dca2
commit 353d40d5fe
8 changed files with 14 additions and 49 deletions
@@ -17,7 +17,7 @@ import com.zfoo.event.model.anno.Bus;
import com.zfoo.event.model.event.IEvent;
import com.zfoo.event.schema.NamespaceHandler;
import com.zfoo.protocol.util.StringUtils;
import com.zfoo.util.security.IdUtils;
import com.zfoo.protocol.util.UuidUtils;
import javassist.*;
import java.lang.reflect.Constructor;
@@ -56,7 +56,7 @@ public abstract class EnhanceUtils {
Class<?> clazz = definition.getEventClazz();
// 定义类名称
CtClass enhanceClazz = classPool.makeClass(EnhanceUtils.class.getCanonicalName() + StringUtils.capitalize(NamespaceHandler.EVENT) + IdUtils.getLocalIntId());
CtClass enhanceClazz = classPool.makeClass(EnhanceUtils.class.getCanonicalName() + StringUtils.capitalize(NamespaceHandler.EVENT) + UuidUtils.getLocalIntId());
enhanceClazz.addInterface(classPool.get(IEventReceiver.class.getCanonicalName()));
// 定义类中的一个成员
@@ -17,8 +17,8 @@ import com.zfoo.monitor.*;
import com.zfoo.net.util.NetUtils;
import com.zfoo.protocol.util.IOUtils;
import com.zfoo.protocol.util.StringUtils;
import com.zfoo.protocol.util.UuidUtils;
import com.zfoo.scheduler.util.TimeUtils;
import com.zfoo.util.security.IdUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import oshi.hardware.HWDiskStore;
@@ -264,7 +264,7 @@ public abstract class OSUtils {
}
public static Monitor maxMonitor() {
var uuid = IdUtils.getUUID();
var uuid = UuidUtils.getUUID();
var monitor = Monitor.valueOf(uuid, maxUptime, new ArrayList<>(maxDfMap.values()), maxFree, new ArrayList<>(maxSarMap.values()));
initMonitor();
@@ -272,7 +272,7 @@ public abstract class OSUtils {
}
public static Monitor monitor() {
var uuid = IdUtils.getUUID();
var uuid = UuidUtils.getUUID();
var uptime = uptime();
var df = df();
var free = free();
@@ -21,7 +21,7 @@ import com.zfoo.protocol.collection.CollectionUtils;
import com.zfoo.protocol.exception.ExceptionUtils;
import com.zfoo.protocol.registration.ProtocolModule;
import com.zfoo.protocol.util.StringUtils;
import com.zfoo.util.security.IdUtils;
import com.zfoo.protocol.util.UuidUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.lang.Nullable;
@@ -39,7 +39,7 @@ public class RegisterVO {
private static final Logger logger = LoggerFactory.getLogger(RegisterVO.class);
private static final String uuid = IdUtils.getUUID();
private static final String uuid = UuidUtils.getUUID();
private String id;
@@ -17,7 +17,7 @@ import com.zfoo.net.router.attachment.IAttachment;
import com.zfoo.net.session.Session;
import com.zfoo.protocol.IPacket;
import com.zfoo.protocol.util.StringUtils;
import com.zfoo.util.security.IdUtils;
import com.zfoo.protocol.util.UuidUtils;
import javassist.*;
import java.lang.reflect.InvocationTargetException;
@@ -54,7 +54,7 @@ public abstract class EnhanceUtils {
var packetClazz = definition.getPacketClazz();
var attachmentClazz = definition.getAttachmentClazz();
var enhanceClazz = classPool.makeClass(EnhanceUtils.class.getCanonicalName() + "Dispatcher" + IdUtils.getLocalIntId());
var enhanceClazz = classPool.makeClass(EnhanceUtils.class.getCanonicalName() + "Dispatcher" + UuidUtils.getLocalIntId());
enhanceClazz.addInterface(classPool.get(IPacketReceiver.class.getCanonicalName()));
var field = new CtField(classPool.get(bean.getClass().getCanonicalName()), "bean", enhanceClazz);
@@ -25,7 +25,7 @@ import org.springframework.context.support.ClassPathXmlApplicationContext;
* @version 3.0
*/
@Ignore
public class MongoIdUtilsTest {
public class MongoUuidUtilsTest {
@Test
public void startApplication0() {
@@ -1,6 +1,5 @@
/*
* Copyright (C) 2020 The zfoo Authors
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
*
@@ -11,7 +10,7 @@
* See the License for the specific language governing permissions and limitations under the License.
*/
package com.zfoo.util.security;
package com.zfoo.protocol.util;
import java.util.UUID;
import java.util.concurrent.atomic.AtomicInteger;
@@ -20,7 +19,7 @@ import java.util.concurrent.atomic.AtomicInteger;
* @author godotg
* @version 3.0
*/
public abstract class IdUtils {
public abstract class UuidUtils {
private static final AtomicInteger ATOMIC_INTEGER = new AtomicInteger(0);
@@ -14,8 +14,8 @@
package com.zfoo.scheduler.model.vo;
import com.zfoo.protocol.util.StringUtils;
import com.zfoo.protocol.util.UuidUtils;
import com.zfoo.scheduler.schema.NamespaceHandler;
import com.zfoo.util.security.IdUtils;
import javassist.*;
import java.lang.reflect.Constructor;
@@ -52,7 +52,7 @@ public abstract class EnhanceUtils {
Method method = reflectScheduler.getMethod();
// 定义类名称
CtClass enhanceClazz = classPool.makeClass(EnhanceUtils.class.getCanonicalName() + StringUtils.capitalize(NamespaceHandler.SCHEDULER) + IdUtils.getLocalIntId());
CtClass enhanceClazz = classPool.makeClass(EnhanceUtils.class.getCanonicalName() + StringUtils.capitalize(NamespaceHandler.SCHEDULER) + UuidUtils.getLocalIntId());
enhanceClazz.addInterface(classPool.get(IScheduler.class.getCanonicalName()));
// 定义类中的一个成员
@@ -1,34 +0,0 @@
/*
* Copyright (C) 2020 The zfoo Authors
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and limitations under the License.
*/
package com.zfoo.util.security;
import org.junit.Assert;
import org.junit.Test;
import java.util.concurrent.atomic.AtomicInteger;
/**
* @author godotg
* @version 3.0
*/
public class IdUtilsTest {
@Test
public void test() {
var atomicInteger = new AtomicInteger(Integer.MAX_VALUE);
atomicInteger.getAndIncrement();
Assert.assertEquals(atomicInteger.get(), Integer.MIN_VALUE);
}
}