@GetMapping("/get-class-uid/{className}")
public ResponseEntity<String> getUid(@PathVariable String className) {
try {
Class<?> classType = Class.forName("com.lgx.service.dto." + className);
Long result = ObjectStreamClass.lookup(classType).getSerialVersionUID();
String a = "private static final long serialVersionUID = ";
return ResponseEntity.ok(a+result.toString()+"L;");
} catch (Exception e) {
e.printStackTrace();
}
return ResponseEntity.ok("");
}
@GetMapping("/get-class-uid/supbase/{className}")
public ResponseEntity<String> getbaseUid(@PathVariable String className) {
try {
Class<?> classType = Class.forName("com.lgx.service.dto.supbase." + className);
Long result = ObjectStreamClass.lookup(classType).getSerialVersionUID();
String a = "private static final long serialVersionUID = ";
return ResponseEntity.ok(a+result.toString()+"L;");
} catch (Exception e) {
e.printStackTrace();
}
return ResponseEntity.ok("");
}
获取java的序列号码
最新推荐文章于 2022-09-22 13:25:13 发布