reuse existing methods whenever applicable
remove unnecessary unboxing
This commit is contained in:
committed by
Mahmoud Ben Hassine
parent
4b1a78323e
commit
a8032196bf
@@ -173,11 +173,11 @@ public class ExecutionContext implements Serializable {
|
||||
*/
|
||||
@Nullable
|
||||
public String getString(String key, String defaultString) {
|
||||
if (!map.containsKey(key)) {
|
||||
if (!containsKey(key)) {
|
||||
return defaultString;
|
||||
}
|
||||
|
||||
return (String) readAndValidate(key, String.class);
|
||||
return getString(key);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -188,7 +188,7 @@ public class ExecutionContext implements Serializable {
|
||||
*/
|
||||
public long getLong(String key) {
|
||||
|
||||
return ((Long) readAndValidate(key, Long.class)).longValue();
|
||||
return (Long) readAndValidate(key, Long.class);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -201,11 +201,11 @@ public class ExecutionContext implements Serializable {
|
||||
* default otherwise
|
||||
*/
|
||||
public long getLong(String key, long defaultLong) {
|
||||
if (!map.containsKey(key)) {
|
||||
if (!containsKey(key)) {
|
||||
return defaultLong;
|
||||
}
|
||||
|
||||
return ((Long) readAndValidate(key, Long.class)).longValue();
|
||||
return getLong(key);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -216,7 +216,7 @@ public class ExecutionContext implements Serializable {
|
||||
*/
|
||||
public int getInt(String key) {
|
||||
|
||||
return ((Integer) readAndValidate(key, Integer.class)).intValue();
|
||||
return (Integer) readAndValidate(key, Integer.class);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -229,11 +229,11 @@ public class ExecutionContext implements Serializable {
|
||||
* default otherwise
|
||||
*/
|
||||
public int getInt(String key, int defaultInt) {
|
||||
if (!map.containsKey(key)) {
|
||||
if (!containsKey(key)) {
|
||||
return defaultInt;
|
||||
}
|
||||
|
||||
return ((Integer) readAndValidate(key, Integer.class)).intValue();
|
||||
return getInt(key);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -243,7 +243,7 @@ public class ExecutionContext implements Serializable {
|
||||
* @return The <code>Double</code> value
|
||||
*/
|
||||
public double getDouble(String key) {
|
||||
return ((Double) readAndValidate(key, Double.class)).doubleValue();
|
||||
return (Double) readAndValidate(key, Double.class);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -256,11 +256,11 @@ public class ExecutionContext implements Serializable {
|
||||
* default otherwise
|
||||
*/
|
||||
public double getDouble(String key, double defaultDouble) {
|
||||
if (!map.containsKey(key)) {
|
||||
if (!containsKey(key)) {
|
||||
return defaultDouble;
|
||||
}
|
||||
|
||||
return ((Double) readAndValidate(key, Double.class)).doubleValue();
|
||||
return getDouble(key);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -284,7 +284,7 @@ public class ExecutionContext implements Serializable {
|
||||
*/
|
||||
private Object readAndValidate(String key, Class<?> type) {
|
||||
|
||||
Object value = map.get(key);
|
||||
Object value = get(key);
|
||||
|
||||
if (!type.isInstance(value)) {
|
||||
throw new ClassCastException("Value for key=[" + key + "] is not of type: [" + type + "], it is ["
|
||||
|
||||
Reference in New Issue
Block a user