//Class clazz = _class;
if(_class.isPrimitive()){
return;
}
if(!_initConstructors && _instantiationConstructor == null){
throw new IllegalClassTypeException(_class);
}
_initConstructors = false;
Constructor[] constructors = _class.getDeclaredConstructors();
for (int i = 0; i < constructors.length; i++) {//find default constructor if exists, and move to first position
Class[] params = constructors[i].getParameterTypes();
if(params.length == 0){
if(i==0){
break;
}
Constructor temp = constructors[0];
constructors[0] = constructors[i];
constructors[i] = temp;
}
}
for (int i = 0; i < constructors.length; i++) {
Constructor constructor = constructors[i];
constructor.setAccessible(true);
Class[] params = constructor.getParameterTypes();
Object[] paramValues = new Object[params.length];
try {
for (int j = 0; j < params.length; j++) {
if(!params[j].isPrimitive()){
continue;
}
paramValues[j] = PrimitiveJavaTypesUtil.getDefaultWrapperInstance(params[j].getName());
}
constructor.newInstance(paramValues);
_instantiationConstructor = constructor;
_instantiationParams = paramValues;
return;
} catch(Throwable e) {
//e.printStackTrace();
}
}
throw new IllegalClassTypeException(_class);
}