mirror of
https://gitee.com/dromara/MaxKey.git
synced 2026-05-14 12:32:09 +08:00
代码优化
This commit is contained in:
@@ -33,7 +33,7 @@ import com.nimbusds.jose.util.Base64URL;
|
||||
|
||||
public class HMAC512Service {
|
||||
|
||||
public final static String MXK_AUTH_JWK = "mxk_auth_jwk";
|
||||
public static final String MXK_AUTH_JWK = "mxk_auth_jwk";
|
||||
|
||||
JWSSigner signer;
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ import com.nimbusds.jose.jwk.JWKSet;
|
||||
*
|
||||
*/
|
||||
public class RecipientJwtEncryptionAndDecryptionServiceBuilder {
|
||||
final static Logger _logger = LoggerFactory.getLogger(RecipientJwtEncryptionAndDecryptionServiceBuilder.class);
|
||||
static final Logger _logger = LoggerFactory.getLogger(RecipientJwtEncryptionAndDecryptionServiceBuilder.class);
|
||||
|
||||
//private HttpClient httpClient = HttpClientBuilder.create().useSystemProperties().build();
|
||||
//private HttpComponentsClientHttpRequestFactory httpFactory = new HttpComponentsClientHttpRequestFactory(httpClient);
|
||||
|
||||
@@ -46,7 +46,7 @@ import com.nimbusds.jose.jwk.RSAKey;
|
||||
import com.nimbusds.jwt.SignedJWT;
|
||||
|
||||
public class DefaultJwtSigningAndValidationService implements JwtSigningAndValidationService {
|
||||
final static Logger _logger = LoggerFactory.getLogger(DefaultJwtSigningAndValidationService.class);
|
||||
static final Logger _logger = LoggerFactory.getLogger(DefaultJwtSigningAndValidationService.class);
|
||||
|
||||
// map of identifier to signer
|
||||
private Map<String, JWSSigner> signers = new HashMap<String, JWSSigner>();
|
||||
|
||||
@@ -37,7 +37,7 @@ import com.nimbusds.jose.jwk.JWK;
|
||||
* Builder Symmetric Signing Service
|
||||
*/
|
||||
public class SymmetricSigningAndValidationServiceBuilder {
|
||||
final static Logger _logger = LoggerFactory.getLogger(SymmetricSigningAndValidationServiceBuilder.class);
|
||||
static final Logger _logger = LoggerFactory.getLogger(SymmetricSigningAndValidationServiceBuilder.class);
|
||||
public static final String SYMMETRIC_KEY = "SYMMETRIC-KEY";
|
||||
/**
|
||||
*
|
||||
|
||||
@@ -21,12 +21,12 @@ import org.springframework.http.ResponseEntity;
|
||||
|
||||
public class Message<T> {
|
||||
|
||||
public final static int SUCCESS = 0; //成功
|
||||
public final static int ERROR = 1; //错误
|
||||
public final static int FAIL = 2; //失败
|
||||
public final static int INFO = 101; //信息
|
||||
public final static int PROMPT = 102; //提示
|
||||
public final static int WARNING = 103; //警告
|
||||
public static final int SUCCESS = 0; //成功
|
||||
public static final int ERROR = 1; //错误
|
||||
public static final int FAIL = 2; //失败
|
||||
public static final int INFO = 101; //信息
|
||||
public static final int PROMPT = 102; //提示
|
||||
public static final int WARNING = 103; //警告
|
||||
|
||||
int code;
|
||||
|
||||
@@ -89,7 +89,7 @@ public class Message<T> {
|
||||
public void setData(T data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
|
||||
public ResponseEntity<?> buildResponse() {
|
||||
return ResponseEntity.ok(this);
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
package org.dromara.maxkey.pretty;
|
||||
|
||||
public interface Pretty {
|
||||
public final static String LINE_BREAK = "\n";
|
||||
public static final String LINE_BREAK = "\n";
|
||||
|
||||
public String format(String source);
|
||||
|
||||
|
||||
@@ -30,33 +30,33 @@ import org.joda.time.chrono.ISOChronology;
|
||||
|
||||
|
||||
public class DateUtils {
|
||||
public final static String FORMAT_DATE_DEFAULT = "yyyy-MM-dd";
|
||||
public static final String FORMAT_DATE_DEFAULT = "yyyy-MM-dd";
|
||||
|
||||
public final static String FORMAT_DATE_YYYYMMDD = "yyyyMMdd";
|
||||
public static final String FORMAT_DATE_YYYYMMDD = "yyyyMMdd";
|
||||
|
||||
public final static String FORMAT_DATE_YYYY_MM_DD = "yyyy-MM-dd";
|
||||
public static final String FORMAT_DATE_YYYY_MM_DD = "yyyy-MM-dd";
|
||||
|
||||
public final static String FORMAT_DATE_PATTERN_1="yyyy/MM/dd";
|
||||
public final static String FORMAT_DATE_PATTERN_2="yyyy/M/dd";
|
||||
public final static String FORMAT_DATE_PATTERN_3="yyyy/MM/d";
|
||||
public final static String FORMAT_DATE_PATTERN_4="yyyy/M/d";
|
||||
public final static String FORMAT_DATE_YYYYMMDDHHMMSS = "yyyyMMddHHmmss";
|
||||
public static final String FORMAT_DATE_PATTERN_1="yyyy/MM/dd";
|
||||
public static final String FORMAT_DATE_PATTERN_2="yyyy/M/dd";
|
||||
public static final String FORMAT_DATE_PATTERN_3="yyyy/MM/d";
|
||||
public static final String FORMAT_DATE_PATTERN_4="yyyy/M/d";
|
||||
public static final String FORMAT_DATE_YYYYMMDDHHMMSS = "yyyyMMddHHmmss";
|
||||
|
||||
public final static String FORMAT_DATE_ISO_TIMESTAMP="yyyy-MM-dd'T'HH:mm:ss.SSS'Z'";
|
||||
public static final String FORMAT_DATE_ISO_TIMESTAMP="yyyy-MM-dd'T'HH:mm:ss.SSS'Z'";
|
||||
|
||||
public final static String FORMAT_DATE_YYYY_MM_DD_HH_MM_SS = "yyyy-MM-dd HH:mm:ss";
|
||||
public static final String FORMAT_DATE_YYYY_MM_DD_HH_MM_SS = "yyyy-MM-dd HH:mm:ss";
|
||||
|
||||
public final static String FORMAT_DATE_YYYY_MM_DD_HHMM = "yyyy-MM-dd HHmm";
|
||||
public static final String FORMAT_DATE_YYYY_MM_DD_HHMM = "yyyy-MM-dd HHmm";
|
||||
|
||||
public final static String FORMAT_DATE_YYYY_MM_DD_HH_MM = "yyyy-MM-dd HH:mm";
|
||||
public static final String FORMAT_DATE_YYYY_MM_DD_HH_MM = "yyyy-MM-dd HH:mm";
|
||||
|
||||
public final static String FORMAT_DATE_HH_MM = "HH:mm";
|
||||
public static final String FORMAT_DATE_HH_MM = "HH:mm";
|
||||
|
||||
public final static String FORMAT_DATE_HH_MM_SS = "HH:mm:ss";
|
||||
public static final String FORMAT_DATE_HH_MM_SS = "HH:mm:ss";
|
||||
|
||||
public final static String FORMAT_DATE_HHMM = "HHmm";
|
||||
public static final String FORMAT_DATE_HHMM = "HHmm";
|
||||
|
||||
public final static String FORMAT_DATE_HHMMSS = "HHmmss";
|
||||
public static final String FORMAT_DATE_HHMMSS = "HHmmss";
|
||||
|
||||
public static final String FORMAT_WORK_TIME = "yyyy-MM-dd HHmmss";
|
||||
/**
|
||||
@@ -74,7 +74,7 @@ public class DateUtils {
|
||||
* stringValue2.
|
||||
* @since 1.2
|
||||
*/
|
||||
public final static int compareDate(String stringValue1, String stringValue2)
|
||||
public static final int compareDate(String stringValue1, String stringValue2)
|
||||
throws ParseException {
|
||||
Date date1 = tryParse(stringValue1);
|
||||
if (date1 == null) {
|
||||
@@ -95,11 +95,11 @@ public class DateUtils {
|
||||
*
|
||||
* @see #FORMAT_DATE_DEFAULT
|
||||
*/
|
||||
public final static String getCurrentDateAsString() {
|
||||
public static final String getCurrentDateAsString() {
|
||||
return getCurrentDateAsString(FORMAT_DATE_DEFAULT);
|
||||
}
|
||||
|
||||
public final static String getCurrentDateTimeAsString() {
|
||||
public static final String getCurrentDateTimeAsString() {
|
||||
return getCurrentDateAsString(FORMAT_DATE_YYYY_MM_DD_HH_MM_SS);
|
||||
}
|
||||
|
||||
@@ -112,12 +112,12 @@ public class DateUtils {
|
||||
* @return current system date.
|
||||
*
|
||||
*/
|
||||
public final static String getCurrentDateAsString(String formatPattern) {
|
||||
public static final String getCurrentDateAsString(String formatPattern) {
|
||||
Date date = new Date();
|
||||
return format(date, formatPattern);
|
||||
}
|
||||
|
||||
public final static String getFormtPattern1ToPattern2(String stringValue,String formatPattern1,String formatPattern2){
|
||||
public static final String getFormtPattern1ToPattern2(String stringValue,String formatPattern1,String formatPattern2){
|
||||
Date date = parse(stringValue, formatPattern1);
|
||||
return format(date, formatPattern2);
|
||||
}
|
||||
@@ -127,7 +127,7 @@ public class DateUtils {
|
||||
*
|
||||
* @return current system date.
|
||||
*/
|
||||
public final static Date getCurrentDate() {
|
||||
public static final Date getCurrentDate() {
|
||||
return new Date();
|
||||
}
|
||||
|
||||
@@ -135,7 +135,7 @@ public class DateUtils {
|
||||
* 0<><30><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, 1<><31><EFBFBD><EFBFBD>һ, 2<><32><EFBFBD>ڶ<EFBFBD>, 3<><33><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, 4<><34><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, 5<><35><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,6<><36><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
* @return
|
||||
*/
|
||||
public final static String getTodayOfWeek(){
|
||||
public static final String getTodayOfWeek(){
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
Date date = new Date();
|
||||
calendar.setTime(date);
|
||||
@@ -149,7 +149,7 @@ public class DateUtils {
|
||||
* @param endTime
|
||||
* @return
|
||||
*/
|
||||
public final static boolean compareTime(String startTime,String endTime) throws ParseException{
|
||||
public static final boolean compareTime(String startTime,String endTime) throws ParseException{
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("hh:mm:ss");
|
||||
Date start = sdf.parse(startTime);
|
||||
Date end = sdf.parse(endTime);
|
||||
@@ -180,7 +180,7 @@ public class DateUtils {
|
||||
*
|
||||
* @see #FORMAT_DATE_DEFAULT
|
||||
*/
|
||||
public final static String format(Date date) {
|
||||
public static final String format(Date date) {
|
||||
if (date == null) {
|
||||
return "";
|
||||
}
|
||||
@@ -196,7 +196,7 @@ public class DateUtils {
|
||||
*
|
||||
* @see #FORMAT_DATE_DEFAULT
|
||||
*/
|
||||
public final static String formatDateTime(Date date) {
|
||||
public static final String formatDateTime(Date date) {
|
||||
if (date == null) {
|
||||
return "";
|
||||
}
|
||||
@@ -212,7 +212,7 @@ public class DateUtils {
|
||||
*
|
||||
* @see #FORMAT_DATE_DEFAULT
|
||||
*/
|
||||
public final static String formatTimestamp(Date date) {
|
||||
public static final String formatTimestamp(Date date) {
|
||||
if (date == null) {
|
||||
return "";
|
||||
}
|
||||
@@ -228,7 +228,7 @@ public class DateUtils {
|
||||
*
|
||||
* @see #FORMAT_DATE_DEFAULT
|
||||
*/
|
||||
public final static Date parseTimestamp(String date) {
|
||||
public static final Date parseTimestamp(String date) {
|
||||
if (date == null) {
|
||||
return null;
|
||||
}
|
||||
@@ -250,7 +250,7 @@ public class DateUtils {
|
||||
* @see #FORMAT_DATE_YYYY_MM_DD_HH_MM_SS
|
||||
* @see #FORMAT_DATE_YYYY_MM_DD_HHMMSS
|
||||
*/
|
||||
public final static String format(Date date, String formatPattern) {
|
||||
public static final String format(Date date, String formatPattern) {
|
||||
if (date == null) {
|
||||
return "";
|
||||
}
|
||||
@@ -265,7 +265,7 @@ public class DateUtils {
|
||||
* @return Date represents stringValue.
|
||||
* @see #FORMAT_DATE_DEFAULT
|
||||
*/
|
||||
public final static Date parse(String stringValue) {
|
||||
public static final Date parse(String stringValue) {
|
||||
return parse(stringValue, FORMAT_DATE_DEFAULT);
|
||||
}
|
||||
|
||||
@@ -279,7 +279,7 @@ public class DateUtils {
|
||||
* @return Date represents stringValue, null while parse exception occurred.
|
||||
* @see #FORMAT_DATE_DEFAULT
|
||||
*/
|
||||
public final static Date parse(String stringValue, String formatPattern) {
|
||||
public static final Date parse(String stringValue, String formatPattern) {
|
||||
SimpleDateFormat format = new SimpleDateFormat(formatPattern);
|
||||
try {
|
||||
return format.parse(stringValue);
|
||||
@@ -297,7 +297,7 @@ public class DateUtils {
|
||||
* string value.
|
||||
* @return Date represents stringValue, null while parse exception occurred.
|
||||
*/
|
||||
public final static Date tryParse(String stringValue) {
|
||||
public static final Date tryParse(String stringValue) {
|
||||
Date date = parse(stringValue, FORMAT_DATE_YYYY_MM_DD);
|
||||
if (date != null) {
|
||||
return date;
|
||||
|
||||
@@ -35,7 +35,7 @@ public class EthernetAddress
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private final static char[] HEX_CHARS = "0123456789abcdefABCDEF".toCharArray();
|
||||
private static final char[] HEX_CHARS = "0123456789abcdefABCDEF".toCharArray();
|
||||
|
||||
/**
|
||||
* We may need a random number generator, for creating dummy ethernet
|
||||
|
||||
@@ -31,28 +31,28 @@ public class SnowFlakeId {
|
||||
/**
|
||||
* 起始的时间戳
|
||||
*/
|
||||
private final static long START_STMP = 1480166465631L;
|
||||
private static final long START_STMP = 1480166465631L;
|
||||
|
||||
/**
|
||||
* 每一部分占用的位数
|
||||
*/
|
||||
private final static long SEQUENCE_BIT = 12; //序列号占用的位数
|
||||
private final static long MACHINE_BIT = 5; //机器标识占用的位数
|
||||
private final static long DATACENTER_BIT = 5;//数据中心占用的位数
|
||||
private static final long SEQUENCE_BIT = 12; //序列号占用的位数
|
||||
private static final long MACHINE_BIT = 5; //机器标识占用的位数
|
||||
private static final long DATACENTER_BIT = 5;//数据中心占用的位数
|
||||
|
||||
/**
|
||||
* 每一部分的最大值
|
||||
*/
|
||||
private final static long MAX_DATACENTER_NUM = -1L ^ (-1L << DATACENTER_BIT);
|
||||
private final static long MAX_MACHINE_NUM = -1L ^ (-1L << MACHINE_BIT);
|
||||
private final static long MAX_SEQUENCE = -1L ^ (-1L << SEQUENCE_BIT);
|
||||
private static final long MAX_DATACENTER_NUM = -1L ^ (-1L << DATACENTER_BIT);
|
||||
private static final long MAX_MACHINE_NUM = -1L ^ (-1L << MACHINE_BIT);
|
||||
private static final long MAX_SEQUENCE = -1L ^ (-1L << SEQUENCE_BIT);
|
||||
|
||||
/**
|
||||
* 每一部分向左的位移
|
||||
*/
|
||||
private final static long MACHINE_LEFT = SEQUENCE_BIT;
|
||||
private final static long DATACENTER_LEFT = SEQUENCE_BIT + MACHINE_BIT;
|
||||
private final static long TIMESTMP_LEFT = DATACENTER_LEFT + DATACENTER_BIT;
|
||||
private static final long MACHINE_LEFT = SEQUENCE_BIT;
|
||||
private static final long DATACENTER_LEFT = SEQUENCE_BIT + MACHINE_BIT;
|
||||
private static final long TIMESTMP_LEFT = DATACENTER_LEFT + DATACENTER_BIT;
|
||||
|
||||
private long datacenterId; //数据中心
|
||||
private long machineId; //机器标识
|
||||
|
||||
Reference in New Issue
Block a user