in shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-tars/src/main/java/org/apache/shenyu/plugin/tars/util/PrxInfoUtil.java [35:85]
static {
PRIMITIVE_TYPE = new HashMap<>();
PRIMITIVE_TYPE.put("int", new PrimitiveType(int.class, o -> {
if (o instanceof String) {
return Integer.valueOf((String) o);
}
return ((Long) o).intValue();
}));
PRIMITIVE_TYPE.put("double", new PrimitiveType(double.class, o -> {
if (o instanceof String) {
return Double.valueOf((String) o);
}
return o;
}));
PRIMITIVE_TYPE.put("long", new PrimitiveType(long.class, o -> {
if (o instanceof String) {
return Long.valueOf((String) o);
}
return o;
}));
PRIMITIVE_TYPE.put("short", new PrimitiveType(short.class, o -> {
if (o instanceof String) {
return Short.valueOf((String) o);
}
return ((Long) o).shortValue();
}));
PRIMITIVE_TYPE.put("byte", new PrimitiveType(byte.class, o -> {
if (o instanceof String) {
return Byte.valueOf((String) o);
}
return ((Long) o).byteValue();
}));
PRIMITIVE_TYPE.put("boolean", new PrimitiveType(boolean.class, o -> {
if (o instanceof String) {
return Byte.valueOf((String) o);
}
return o;
}));
PRIMITIVE_TYPE.put("char", new PrimitiveType(char.class, o -> {
if (o instanceof String) {
return String.valueOf(o).charAt(0);
}
return o;
}));
PRIMITIVE_TYPE.put("float", new PrimitiveType(float.class, o -> {
if (o instanceof String) {
return Float.valueOf((String) o);
}
return ((Double) o).floatValue();
}));
}