package com.changhong.autoform.core.tool;
|
|
import javax.sql.DataSource;
|
|
/**
|
* 线程存储区的key
|
* @author WangYX
|
*
|
*/
|
public class Keys<T> {
|
|
private String key;
|
|
private Class<T> clazz;
|
|
private T defaultValue;
|
|
public Keys(String key, Class<T> clazz) {
|
super();
|
this.key = key;
|
this.clazz = clazz;
|
}
|
|
public Keys(String key, Class<T> clazz, T defaultValue) {
|
super();
|
this.key = key;
|
this.clazz = clazz;
|
this.defaultValue = defaultValue;
|
}
|
|
public static <T> Keys<T> getKeys(String key, Class<T> clazz){
|
return new Keys<>(key, clazz);
|
}
|
|
public static <T> Keys<T> getKeys(String key, Class<T> clazz, T defaultValue){
|
return new Keys<>(key, clazz, defaultValue);
|
}
|
|
|
public String getKey() {
|
return key;
|
}
|
|
public void setKey(String key) {
|
this.key = key;
|
}
|
|
public Class<T> getClazz() {
|
return clazz;
|
}
|
|
public void setClazz(Class<T> clazz) {
|
this.clazz = clazz;
|
}
|
|
public T getDefaultValue() {
|
return defaultValue;
|
}
|
|
public void setDefaultValue(T defaultValue) {
|
this.defaultValue = defaultValue;
|
}
|
|
|
/**
|
* 数据源
|
*/
|
public static final Keys<DataSource> DATA_SOURCE = getKeys("DATA_SOURCE", DataSource.class);
|
}
|