code clean

This commit is contained in:
东皇 2017-07-10 11:44:54 +08:00
parent c7c9ed1198
commit f729548036
6 changed files with 13 additions and 11 deletions

View File

@ -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();

View File

@ -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);

View File

@ -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);

View File

@ -12,6 +12,8 @@ import lombok.RequiredArgsConstructor;
@Getter
@RequiredArgsConstructor
public class SqlFragment implements Serializable {
private static final long serialVersionUID = 1L;
private final String sql;
/**

View File

@ -16,6 +16,7 @@ import java.util.Arrays;
public class ViewModelSerializerTest {
@Test
@SuppressWarnings("unchecked")
public void test() {
SerializeConfig.getGlobalInstance()
.put(ViewModel.class, new ViewModelableSerializer());

View File

@ -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();
}
}