private final Pattern compile = Pattern.compile("^(is|get)(.)(.*)$");
private Map<String, String> getNormalKeyValue(Object obj) {
Map<String, String> map = new HashMap<>(16);
Method[] declaredMethods = obj.getClass().getDeclaredMethods();
for (Method method : declaredMethods) {
Class<?> returnType = method.getReturnType();
try {
if (method.getModifiers() == Modifier.PUBLIC && method.getParameterCount() == 0
&& (method.getName().startsWith("get") || method.getName().startsWith("is")) && (String.class.equals(returnType)
|| returnType.isPrimitive() || ((Class) returnType.getField("TYPE").get(null)).isPrimitive())) {
Object fieldV = method.invoke(obj);
if (Objects.isNull(fieldV)) {
continue;
}
Matcher matcher = compile.matcher(method.getName());
if (matcher.find()) {
map.put("_requestManager." + matcher.group(2).toLowerCase() + matcher.group(3), fieldV.toString());
}
}
} catch (Exception e) {
writeLog(e);
}
}
return map;
}