Code example for Constructor

Methods: getParameterTypes, newInstance

0
		throw new IllegalArgumentException("No constructor of " + newObjClass + " with one parameter of class DBObjInstantiator does exist (beneath the hidden inner class constructor parameter). " +
				"This is needed for a new DB object to be deserialized."); 
	} 
 
	private DBObject tryConstructor(Constructor<?> con, Map<String, String> fieldList, Class<?> clazz) throws DBInstantiationException {
		Class<?>[] pts = con.getParameterTypes();
		if (pts.length != 2) return null;	//the outer DB class of the DBIDObject and the Map parameter 
		if (!pts[0].equals(this.getClass())) throw new DBInstantiationException ("The object of class " + clazz + " that shall be instantiated is not an inner class of " + this.getClass() + ".");
		if (!pts[1].equals(IDBObjInstantiator.class)) return null;
		try { 
			DBObject obj = (DBObject)con.newInstance(RelationalDB.this, new DBObjInstantiatorImpl(fieldList));
			//Field [] fs = obj.getClass().getFields(); 
			return obj;
		} catch (IllegalArgumentException e) {
			throw new DBInstantiationException(e);
		} catch (InstantiationException e) {
			throw new DBInstantiationException(e);
		} catch (IllegalAccessException e) {
			throw new DBInstantiationException(e);
		} catch (InvocationTargetException e) {
			throw new DBInstantiationException(e.getTargetException());