Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unnecessary call to Long.ValueOf in ReflectionUtil #407

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions library/src/main/java/com/orm/util/ReflectionUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ public static void setFieldValueFromCursor(Cursor cursor, Field field, Object ob

if (colName.equalsIgnoreCase("id")) {
long cid = cursor.getLong(columnIndex);
field.set(object, Long.valueOf(cid));
field.set(object, cid);
} else if (fieldType.equals(long.class) || fieldType.equals(Long.class)) {
field.set(object,
cursor.getLong(columnIndex));
Expand Down Expand Up @@ -212,7 +212,8 @@ public static void setFieldValueFromCursor(Cursor cursor, Field field, Object ob
Log.e("Sugar", "Enum cannot be read from Sqlite3 database. Please check the type of field " + field.getName());
}
} else
Log.e("Sugar", "Class cannot be read from Sqlite3 database. Please check the type of field " + field.getName() + "(" + field.getType().getName() + ")");
Log.e("Sugar", "Class cannot be read from Sqlite3 database. Please check the type of field "
+ field.getName() + "(" + field.getType().getName() + ")");
} catch (IllegalArgumentException e) {
Log.e("field set error", e.getMessage());
} catch (IllegalAccessException e) {
Expand Down Expand Up @@ -324,7 +325,7 @@ private static List<String> getAllClasses(Context context) throws PackageManager
private static void populateFiles(File path, List<String> fileNames, String parent) {
if (path.isDirectory()) {
for (File newPath : path.listFiles()) {
if ("".equals(parent)) {
if (parent.isEmpty()) {
populateFiles(newPath, fileNames, path.getName());
} else {
populateFiles(newPath, fileNames, parent + "." + path.getName());
Expand All @@ -335,7 +336,7 @@ private static void populateFiles(File path, List<String> fileNames, String pare
String classSuffix = ".class";
pathName = pathName.endsWith(classSuffix) ?
pathName.substring(0, pathName.length() - classSuffix.length()) : pathName;
if ("".equals(parent)) {
if (parent.isEmpty()) {
fileNames.add(pathName);
} else {
fileNames.add(parent + "." + pathName);
Expand Down