Fixed some code smells in FlatFileDatabaseHandler

These code smells were fixed according to sonarcloud analytics
This commit is contained in:
Florian CUNY 2018-02-13 17:49:35 +01:00
parent 328255e3dd
commit 0b6da56e82

View File

@ -111,12 +111,7 @@ public class FlatFileDatabaseHandler<T> extends AbstractDatabaseHandler<T> {
public List<T> loadObjects() throws InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, IntrospectionException, ClassNotFoundException { public List<T> loadObjects() throws InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, IntrospectionException, ClassNotFoundException {
List<T> list = new ArrayList<>(); List<T> list = new ArrayList<>();
FilenameFilter ymlFilter = (dir, name) -> { FilenameFilter ymlFilter = (dir, name) -> {
String lowercaseName = name.toLowerCase(); return name.toLowerCase().endsWith(".yml");
if (lowercaseName.endsWith(".yml")) {
return true;
} else {
return false;
}
}; };
String path = dataObject.getSimpleName(); String path = dataObject.getSimpleName();
StoreAt storeAt = dataObject.getAnnotation(StoreAt.class); StoreAt storeAt = dataObject.getAnnotation(StoreAt.class);
@ -489,7 +484,7 @@ public class FlatFileDatabaseHandler<T> extends AbstractDatabaseHandler<T> {
} }
// Types that need to be deserialized // Types that need to be deserialized
if (clazz.equals(Long.class) && value.getClass().equals(Integer.class)) { if (clazz.equals(Long.class) && value.getClass().equals(Integer.class)) {
return new Long((Integer)value); return Long.valueOf((Integer) value);
} }
if (clazz.equals(UUID.class)) { if (clazz.equals(UUID.class)) {
value = UUID.fromString((String)value); value = UUID.fromString((String)value);