476 try {
477 argsForConstruction[i++] = BeanAdapter.coerce(value, tp);
478 } catch (Exception ex) {
479 return null;
480 }
481 }
482
483 try {
484 retObj = createInstance(c, argsForConstruction);
485 } catch (Exception ex) {
486 // will try to fall back to different constructor
487 }
488
489 return retObj;
490 }
491
492 private Object createInstance(Constructor c, Object args[]) throws Exception {
493 Object retObj = null;
494
495 ReflectUtil.checkPackageAccess(type);
496 Object thisModule = ModuleHelper.getModule(this.getClass());
497 ModuleHelper.addReads(thisModule, ModuleHelper.getModule(type));
498 retObj = c.newInstance(args);
499
500 return retObj;
501 }
502
503 private Map<String, Property> scanForSetters() {
504 Map<String, Property> strsMap = new HashMap<>();
505 Map<String, LinkedList<Method>> methods = getClassMethodCache(type);
506
507 for (String methodName : methods.keySet()) {
508 if (methodName.startsWith(SETTER_PREFIX) && methodName.length() > SETTER_PREFIX.length()) {
509 String propName = methodName.substring(SETTER_PREFIX.length());
510 propName = Character.toLowerCase(propName.charAt(0)) + propName.substring(1);
511 List<Method> methodsList = methods.get(methodName);
512 for (Method m : methodsList) {
513 Class<?> retType = m.getReturnType();
514 Class<?> argType[] = m.getParameterTypes();
515 if (retType.equals(Void.TYPE) && argType.length == 1) {
516 strsMap.put(propName, new Setter(m, argType[0]));
517 }
|
476 try {
477 argsForConstruction[i++] = BeanAdapter.coerce(value, tp);
478 } catch (Exception ex) {
479 return null;
480 }
481 }
482
483 try {
484 retObj = createInstance(c, argsForConstruction);
485 } catch (Exception ex) {
486 // will try to fall back to different constructor
487 }
488
489 return retObj;
490 }
491
492 private Object createInstance(Constructor c, Object args[]) throws Exception {
493 Object retObj = null;
494
495 ReflectUtil.checkPackageAccess(type);
496 retObj = c.newInstance(args);
497
498 return retObj;
499 }
500
501 private Map<String, Property> scanForSetters() {
502 Map<String, Property> strsMap = new HashMap<>();
503 Map<String, LinkedList<Method>> methods = getClassMethodCache(type);
504
505 for (String methodName : methods.keySet()) {
506 if (methodName.startsWith(SETTER_PREFIX) && methodName.length() > SETTER_PREFIX.length()) {
507 String propName = methodName.substring(SETTER_PREFIX.length());
508 propName = Character.toLowerCase(propName.charAt(0)) + propName.substring(1);
509 List<Method> methodsList = methods.get(methodName);
510 for (Method m : methodsList) {
511 Class<?> retType = m.getReturnType();
512 Class<?> argType[] = m.getParameterTypes();
513 if (retType.equals(Void.TYPE) && argType.length == 1) {
514 strsMap.put(propName, new Setter(m, argType[0]));
515 }
|