code clean
This commit is contained in:
parent
c7c9ed1198
commit
f729548036
@ -19,7 +19,7 @@ public class ViewModelableSerializer implements ObjectSerializer {
|
||||
@Override
|
||||
public void write(JSONSerializer serializer, Object object, Object fieldName, Type fieldType, int features) throws IOException {
|
||||
if (object != null) {
|
||||
serializer.write(((ViewModelable) object).toMap());
|
||||
serializer.write(((ViewModelable<?>) object).toMap());
|
||||
}
|
||||
else {
|
||||
serializer.writeNull();
|
||||
|
@ -58,6 +58,7 @@ public class ViewModel<T>
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public <A> A getAttr(String name) {
|
||||
return attrs != null ? (A) attrs.get(name) : null;
|
||||
}
|
||||
@ -93,7 +94,7 @@ public class ViewModel<T>
|
||||
else {
|
||||
if (data instanceof ViewModelable) {
|
||||
mapRtn = new HashMap<String, Object>();
|
||||
mapRtn.put("data", ((ViewModelable) data).toMap());
|
||||
mapRtn.put("data", ((ViewModelable<?>) data).toMap());
|
||||
}
|
||||
else {
|
||||
Object jsonData = JSON.toJSON(data);
|
||||
|
@ -134,7 +134,7 @@ public class Search implements Serializable {
|
||||
criteria.add(new Criterion(CriterionType.IS_NULL, col, value));
|
||||
}
|
||||
else if (value instanceof Collection) {
|
||||
in(col, (Collection) value);
|
||||
in(col, (Collection<?>) value);
|
||||
}
|
||||
else if (value.getClass().isArray()) {
|
||||
in(col, (Object[]) value);
|
||||
|
@ -12,6 +12,8 @@ import lombok.RequiredArgsConstructor;
|
||||
@Getter
|
||||
@RequiredArgsConstructor
|
||||
public class SqlFragment implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private final String sql;
|
||||
|
||||
/**
|
||||
|
@ -16,6 +16,7 @@ import java.util.Arrays;
|
||||
public class ViewModelSerializerTest {
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("unchecked")
|
||||
public void test() {
|
||||
SerializeConfig.getGlobalInstance()
|
||||
.put(ViewModel.class, new ViewModelableSerializer());
|
||||
|
@ -1,11 +1,10 @@
|
||||
package me.chyxion.tigon.shiro.cache.shiro;
|
||||
|
||||
import java.util.Set;
|
||||
import org.slf4j.Logger;
|
||||
import java.io.Serializable;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import javax.annotation.PostConstruct;
|
||||
import org.springframework.util.Assert;
|
||||
@ -25,9 +24,8 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
* chyxion@163.com <br>
|
||||
* May 12, 2016 1:25:02 PM
|
||||
*/
|
||||
@Slf4j
|
||||
public class UserIdKeyRedisSessionCache implements SessionCache {
|
||||
private static final Logger log =
|
||||
LoggerFactory.getLogger(UserIdKeyRedisSessionCache.class);
|
||||
|
||||
@Autowired
|
||||
protected RedisTemplate<Serializable, Serializable> redisTpl;
|
||||
@ -166,6 +164,6 @@ public class UserIdKeyRedisSessionCache implements SessionCache {
|
||||
}
|
||||
|
||||
protected ValueOperations<Serializable, Serializable> valueOp() {
|
||||
return redisTpl.<Serializable, Serializable>opsForValue();
|
||||
return redisTpl.opsForValue();
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user