in restful/src/main/java/org/apache/shardingsphere/elasticjob/restful/pipeline/HandlerParameterDecoder.java [139:170]
private Object deserializeBuiltInType(final Class<?> targetType, final String value) {
Preconditions.checkArgument(!value.isEmpty(), "Cannot deserialize empty value.");
if (String.class.equals(targetType)) {
return value;
}
if (Boolean.class.equals(targetType) || boolean.class.equals(targetType)) {
return Boolean.parseBoolean(value);
}
if (Character.class.equals(targetType) || char.class.equals(targetType)) {
Preconditions.checkArgument(1 >= value.length(), MessageFormat.format("Cannot set value [{0}] into a char.", value));
return value.charAt(0);
}
if (Byte.class.equals(targetType) || byte.class.equals(targetType)) {
return Byte.parseByte(value);
}
if (Short.class.equals(targetType) || short.class.equals(targetType)) {
return Short.parseShort(value);
}
if (Integer.class.equals(targetType) || int.class.equals(targetType)) {
return Integer.parseInt(value);
}
if (Long.class.equals(targetType) || long.class.equals(targetType)) {
return Long.parseLong(value);
}
if (Float.class.equals(targetType) || float.class.equals(targetType)) {
return Float.parseFloat(value);
}
if (Double.class.equals(targetType) || double.class.equals(targetType)) {
return Double.parseDouble(value);
}
throw new IllegalArgumentException(MessageFormat.format("Cannot deserialize path variable [{0}] into [{1}]", value, targetType.getName()));
}