<p>newInstanceUsingCoercion.</p>

@param args a {@link java.lang.String} object.
@return a T object.
@throws java.lang.Throwable if any.
501980
public T newInstanceUsingCoercion(String... args) throws Throwable
    {
        Constructor<? extends T> constructor = ClassUtils.findPossibleConstructor(klass, args);
        Class[] types = constructor.getParameterTypes();
        return newInstance( TypeConversion.convert( args, types ) );
    }
892287
public static <T> T newInstance(Class<T> clazz) throws MjdbcException {
        try {
            return clazz.newInstance();

        } catch (InstantiationException ex) {
            throw new MjdbcException(
                    "Failed to create instance: " + clazz.getName() + " - " + ex.getMessage());

        } catch (IllegalAccessException ex) {
            throw new MjdbcException(
                    "Failed to create instance: " + clazz.getName() + " - " + ex.getMessage());
        }
    }
435265
public static Object newInstance(Class<?> entity) {
		if (entity == null) {
			return null;
		}
		try {
			return entity.newInstance();
		} catch (Exception e) {
			throw new RuntimeException(e);
		}
	}
55029
static <T> T newInstance(Class<T> cls) {
        try {
            return cls.newInstance();
        } catch (Exception e) {
            throw wrap(e);
        }
    }
817146
public static <T> T newInstance(Class<T> aClass)
    {
        try
        {
            return aClass.getConstructor().newInstance();
        }
        catch (InstantiationException e)
        {
            throw new RuntimeException(e);
        }
        catch (IllegalAccessException e)
        {
            throw new RuntimeException(e);
        }
        catch (NoSuchMethodException e)
        {
            throw new RuntimeException(e);
        }
        catch (InvocationTargetException e)
        {
            throw new RuntimeException(e);
        }
    }
695395
protected T createInstance() {
        try {
            Constructor<T> ctor = clazz.getDeclaredConstructor();
            ctor.setAccessible(true);
            return ctor.newInstance();
        } catch (InstantiationException e) {
            throw new RuntimeException(e);
        } catch (IllegalAccessException e) {
            throw new RuntimeException(e);
        } catch (SecurityException e) {
            throw new RuntimeException(e);
        } catch (NoSuchMethodException e) {
            throw new RuntimeException(e);
        } catch (IllegalArgumentException e) {
            throw new RuntimeException(e);
        } catch (InvocationTargetException e) {
            throw new RuntimeException(e);
        }
    }
284391
public static <T> T newInstance(String name) {
        try {
            return (T) getClass(name).newInstance();
        } catch (InstantiationException | ClassNotFoundException | IllegalAccessException e) {
            throw new IllegalStateException(e.getMessage(), e);
        }
    }
854534
public Object create(String name, Object... args)
    throws ClassNotFoundException,
           NoSuchMethodException,
           IllegalAccessException,
           InstantiationException,
           InvocationTargetException
    {
//StringBuilder sb = new StringBuilder("DefaultObjectFactory.create(").append(name).append(',');
//for (Object arg: args) {
//sb.append(arg.getClass().getName()).append(' ');
//}
//sb.append(')');
//System.err.println(sb);
        try {
            Class<?> type = Class.forName(name);
/*
            Constructor<?>[] constructors = type.getConstructors();
            for (Constructor<?> constructor: constructors) {
                Class<?>[] ptypes = constructor.getParameterTypes();
                if (ptypes.length == args.length) {
                    try {
                        return constructor.newInstance(args);
                    } catch (IllegalArgumentException x) {
                        // ignore and try the next one
                    } catch (IllegalAccessException x) {
                        throw x;
                    } catch (InstantiationException x) {
                        throw x;
                    } catch (InvocationTargetException x) {
                        throw x;
                    }
                }
            }
            throw new NoSuchMethodException("Can't locate a desired constructor in " + name);
*/
//System.err.println("DefaultObjectFactory.create: successful");
            return Beans.create(type, args);
        } catch (ClassNotFoundException x) {
            throw x;
        }
    }
23544
@Override
	public OUTPUT newInstance(Map<String, INPUT> inputMap) throws FAILURE {
		
		StringBuilder builder = new StringBuilder()
		.append(getClass().getName())
		.append(".newInstance(Map<String, Input>) is unsupported.");
		
		throw new UnsupportedOperationException(builder.toString());
	}
324534
protected T createInstance() {
		try {
			return targetClass.newInstance();
		} catch (InstantiationException e) {
			throw new RuntimeException(e);
		} catch (IllegalAccessException e) {
			throw new RuntimeException(e);
		}
	}
475849
public static <T> T newInstance(final T value) throws MIDDException {
        if (value == null) {
            return null;
        } else {
            return newInstance(value, value.getClass());
        }

    }
403921
public static <T> T newInstance(Class<T> clazz) {
		try {
			return clazz.newInstance();
		}
		catch (InstantiationException | IllegalAccessException e) {
			throw new ResourceException(String.format("couldn't create a new instance of %s", clazz));
		}
	}
738699
public Object createNewInstance(Class[] types, Object[] args)
    {
        try
        {
            Object result;
            // create an instance of the target class
            if (types != null)
            {
                result = ClassHelper.newInstance(getClassToServe(), types, args, true);
            }
            else
            {
                result = ClassHelper.newInstance(getClassToServe(), true);
            }
            // if defined in OJB.properties all instances are wrapped by an interceptor
            result = InterceptorFactory.getInstance().createInterceptorFor(result);
            return result;

        }
        catch (InstantiationException e)
        {
            getLogger().error("ConfigurableFactory can't instantiate class " +
                    getClassToServe() + buildArgumentString(types, args), e);
            throw new PersistenceBrokerException(e);
        }
        catch (IllegalAccessException e)
        {
            getLogger().error("ConfigurableFactory can't access constructor for class " +
                    getClassToServe() + buildArgumentString(types, args), e);
            throw new PersistenceBrokerException(e);
        }
        catch (Exception e)
        {
            getLogger().error("ConfigurableFactory instantiation failed for class " +
                    getClassToServe() + buildArgumentString(types, args), e);
            throw new PersistenceBrokerException(e);
        }
    }
1332993
public static <T> T newInstance(Type type) {
        try {
            Class<T> clazz = (Class<T>) getClass(type);
            if (clazz == null) {
                return null;
            }
            return clazz.newInstance();
        } catch (Exception e) {
            log.warn("new instance fail :{}", e.getCause().toString());
            throw new NewInstanceException(e.getCause().toString());
        }
    }
221866
public static Object newInstance(Class target, Class[] types, Object[] args) throws InstantiationException,
                                                                                        IllegalAccessException,
                                                                                        IllegalArgumentException,
                                                                                        InvocationTargetException,
                                                                                        NoSuchMethodException,
                                                                                        SecurityException
    {
        return newInstance(target, types, args, false);
    }
343431
public static <T> T newInstance(final Class<T> clazz) {
        try {
            return clazz.newInstance();
        } catch (InstantiationException | IllegalAccessException e) {
            throw new ClassApiException(e);
        }
    }
1300898
public static <T> T newInstanceWithArgs(Class<T> clazz, Class<?>[] argTypes, Object[] args)
        throws SofaRpcRuntimeException {
        if (CommonUtils.isEmpty(argTypes)) {
            return newInstance(clazz);
        }
        try {
            if (!(clazz.isMemberClass() && !Modifier.isStatic(clazz.getModifiers()))) {
                Constructor<T> constructor = clazz.getDeclaredConstructor(argTypes);
                constructor.setAccessible(true);
                return constructor.newInstance(args);
            } else {
                Constructor<T>[] constructors = (Constructor<T>[]) clazz.getDeclaredConstructors();
                if (constructors == null || constructors.length == 0) {
                    throw new SofaRpcRuntimeException("The " + clazz.getCanonicalName()
                        + " has no constructor with argTypes :" + Arrays.toString(argTypes));
                }
                Constructor<T> constructor = null;
                for (Constructor<T> c : constructors) {
                    Class[] ps = c.getParameterTypes();
                    if (ps.length == argTypes.length + 1) { // 长度多一
                        boolean allMath = true;
                        for (int i = 1; i < ps.length; i++) { // 而且第二个开始的参数类型匹配
                            if (ps[i] != argTypes[i - 1]) {
                                allMath = false;
                                break;
                            }
                        }
                        if (allMath) {
                            constructor = c;
                            break;
                        }
                    }
                }
                if (constructor == null) {
                    throw new SofaRpcRuntimeException("The " + clazz.getCanonicalName()
                        + " has no constructor with argTypes :" + Arrays.toString(argTypes));
                } else {
                    constructor.setAccessible(true);
                    Object[] newArgs = new Object[args.length + 1];
                    System.arraycopy(args, 0, newArgs, 1, args.length);
                    return constructor.newInstance(newArgs);
                }
            }
        } catch (SofaRpcRuntimeException e) {
            throw e;
        } catch (Throwable e) {
            throw new SofaRpcRuntimeException(e.getMessage(), e);
        }
    }