Package com.mobixess.jodb.core

Examples of com.mobixess.jodb.core.IllegalClassTypeException


            //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);
        }
View Full Code Here


                    }
                }
                return _instantiationConstructor.newInstance(instantiationParams);
            } catch (Exception e) {
                e.printStackTrace();
                throw new IllegalClassTypeException(_class);
            }
        }
View Full Code Here

TOP

Related Classes of com.mobixess.jodb.core.IllegalClassTypeException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.