Generic cleanup of warnings, whitespace and style.
By: Erik Broes <erikbroes@grum.nl>
This commit is contained in:
@@ -8,12 +8,12 @@ public final class NumberConversions {
|
||||
|
||||
public static int toInt(Object object) {
|
||||
if (object instanceof Number) {
|
||||
return ((Number)object).intValue();
|
||||
return ((Number) object).intValue();
|
||||
} else {
|
||||
int result = 0;
|
||||
|
||||
try {
|
||||
result = Integer.valueOf((String)object);
|
||||
result = Integer.valueOf((String) object);
|
||||
} catch (Throwable ex) {}
|
||||
|
||||
return result;
|
||||
@@ -22,12 +22,12 @@ public final class NumberConversions {
|
||||
|
||||
public static float toFloat(Object object) {
|
||||
if (object instanceof Number) {
|
||||
return ((Number)object).floatValue();
|
||||
return ((Number) object).floatValue();
|
||||
} else {
|
||||
float result = 0;
|
||||
|
||||
try {
|
||||
result = Float.valueOf((String)object);
|
||||
result = Float.valueOf((String) object);
|
||||
} catch (Throwable ex) {}
|
||||
|
||||
return result;
|
||||
@@ -36,12 +36,12 @@ public final class NumberConversions {
|
||||
|
||||
public static double toDouble(Object object) {
|
||||
if (object instanceof Number) {
|
||||
return ((Number)object).doubleValue();
|
||||
return ((Number) object).doubleValue();
|
||||
} else {
|
||||
double result = 0;
|
||||
|
||||
try {
|
||||
result = Double.valueOf((String)object);
|
||||
result = Double.valueOf((String) object);
|
||||
} catch (Throwable ex) {}
|
||||
|
||||
return result;
|
||||
@@ -50,12 +50,12 @@ public final class NumberConversions {
|
||||
|
||||
public static long toLong(Object object) {
|
||||
if (object instanceof Number) {
|
||||
return ((Number)object).longValue();
|
||||
return ((Number) object).longValue();
|
||||
} else {
|
||||
long result = 0;
|
||||
|
||||
try {
|
||||
result = Long.valueOf((String)object);
|
||||
result = Long.valueOf((String) object);
|
||||
} catch (Throwable ex) {}
|
||||
|
||||
return result;
|
||||
@@ -64,12 +64,12 @@ public final class NumberConversions {
|
||||
|
||||
public static short toShort(Object object) {
|
||||
if (object instanceof Number) {
|
||||
return ((Number)object).shortValue();
|
||||
return ((Number) object).shortValue();
|
||||
} else {
|
||||
short result = 0;
|
||||
|
||||
try {
|
||||
result = Short.valueOf((String)object);
|
||||
result = Short.valueOf((String) object);
|
||||
} catch (Throwable ex) {}
|
||||
|
||||
return result;
|
||||
@@ -78,12 +78,12 @@ public final class NumberConversions {
|
||||
|
||||
public static byte toByte(Object object) {
|
||||
if (object instanceof Number) {
|
||||
return ((Number)object).byteValue();
|
||||
return ((Number) object).byteValue();
|
||||
} else {
|
||||
byte result = 0;
|
||||
|
||||
try {
|
||||
result = Byte.valueOf((String)object);
|
||||
result = Byte.valueOf((String) object);
|
||||
} catch (Throwable ex) {}
|
||||
|
||||
return result;
|
||||
|
||||
Reference in New Issue
Block a user