Skip to content

Commit 01be162

Browse files
committed
few cleanings for more redeable code
1 parent 0150451 commit 01be162

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

library/src/main/java/com/orm/util/ReflectionUtil.java

+6-5
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ public static void setFieldValueFromCursor(Cursor cursor, Field field, Object ob
159159

160160
if (colName.equalsIgnoreCase("id")) {
161161
long cid = cursor.getLong(columnIndex);
162-
field.set(object, Long.valueOf(cid));
162+
field.set(object, cid);
163163
} else if (fieldType.equals(long.class) || fieldType.equals(Long.class)) {
164164
field.set(object,
165165
cursor.getLong(columnIndex));
@@ -212,7 +212,8 @@ public static void setFieldValueFromCursor(Cursor cursor, Field field, Object ob
212212
Log.e("Sugar", "Enum cannot be read from Sqlite3 database. Please check the type of field " + field.getName());
213213
}
214214
} else
215-
Log.e("Sugar", "Class cannot be read from Sqlite3 database. Please check the type of field " + field.getName() + "(" + field.getType().getName() + ")");
215+
Log.e("Sugar", "Class cannot be read from Sqlite3 database. Please check the type of field "
216+
+ field.getName() + "(" + field.getType().getName() + ")");
216217
} catch (IllegalArgumentException e) {
217218
Log.e("field set error", e.getMessage());
218219
} catch (IllegalAccessException e) {
@@ -316,15 +317,15 @@ private static List<String> getAllClasses(Context context) throws PackageManager
316317
}
317318
}
318319
} finally {
319-
if (null != dexfile) dexfile.close();
320+
if (dexfile != null) dexfile.close();
320321
}
321322
return classNames;
322323
}
323324

324325
private static void populateFiles(File path, List<String> fileNames, String parent) {
325326
if (path.isDirectory()) {
326327
for (File newPath : path.listFiles()) {
327-
if ("".equals(parent)) {
328+
if (parent.isEmpty()) {
328329
populateFiles(newPath, fileNames, path.getName());
329330
} else {
330331
populateFiles(newPath, fileNames, parent + "." + path.getName());
@@ -335,7 +336,7 @@ private static void populateFiles(File path, List<String> fileNames, String pare
335336
String classSuffix = ".class";
336337
pathName = pathName.endsWith(classSuffix) ?
337338
pathName.substring(0, pathName.length() - classSuffix.length()) : pathName;
338-
if ("".equals(parent)) {
339+
if (parent.isEmpty()) {
339340
fileNames.add(pathName);
340341
} else {
341342
fileNames.add(parent + "." + pathName);

0 commit comments

Comments
 (0)