Commit 77f84d8b by 陈文顺

redis getClazz

parent 6390709d
......@@ -15,11 +15,17 @@ public abstract class RedisCache<T> {
@Autowired
protected RedisUitl redisUitl;
private Class<T> clazz;
public Class<T> getClazz(){
public RedisCache() {
Type type = getClass().getGenericSuperclass();
Type trueType = ((ParameterizedType)type).getActualTypeArguments()[0];
return (Class<T>) trueType;
clazz = (Class<T>) trueType;
}
public Class<T> getClazz(){
return clazz;
}
......
......@@ -17,11 +17,16 @@ public abstract class RedisHashCache<T> {
@Autowired
protected RedisTemplate redisTemplate;
private Class<T> clazz;
public Class<T> getClazz(){
public RedisHashCache() {
Type type = getClass().getGenericSuperclass();
Type trueType = ((ParameterizedType)type).getActualTypeArguments()[0];
return (Class<T>) trueType;
clazz = (Class<T>) trueType;
}
public Class<T> getClazz(){
return clazz;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment