/** * <p>Convenience method returning new instance of <code>klazz</code> using a single argument constructor. * The formal parameter type is inferred from the actual values of <code>arg</code>. * See {@link #invokeExactConstructor(Class, Object[], Class[])} for more details.</p> * * <p>The signatures should be assignment compatible.</p> * * @param <T> the type of the object to be constructed * @param klass the class to be constructed. * @param arg the actual argument. May be null (this will result in calling the default constructor). * @return new instance of <code>klazz</code> * * @throws NoSuchMethodException If the constructor cannot be found * @throws IllegalAccessException If an error occurs accessing the constructor * @throws InvocationTargetException If an error occurs invoking the constructor * @throws InstantiationException If an error occurs instantiating the class * * @see #invokeConstructor(java.lang.Class, java.lang.Object[], java.lang.Class[]) */ public static <T> T invokeConstructor(final Class<T> klass, final Object arg) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException, InstantiationException { final Object[] args = toArray(arg); return invokeConstructor(klass, args); }
/** * <p>Convenience method returning new instance of <code>klazz</code> using a single argument constructor. * The formal parameter type is inferred from the actual values of <code>arg</code>. * See {@link #invokeExactConstructor(Class, Object[], Class[])} for more details.</p> * * <p>The signatures should match exactly.</p> * * @param <T> the type of the object to be constructed * @param klass the class to be constructed. * @param arg the actual argument. May be null (this will result in calling the default constructor). * @return new instance of <code>klazz</code> * * @throws NoSuchMethodException If the constructor cannot be found * @throws IllegalAccessException If an error occurs accessing the constructor * @throws InvocationTargetException If an error occurs invoking the constructor * @throws InstantiationException If an error occurs instantiating the class * * @see #invokeExactConstructor(java.lang.Class, java.lang.Object[], java.lang.Class[]) */ public static <T> T invokeExactConstructor(final Class<T> klass, final Object arg) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException, InstantiationException { final Object[] args = toArray(arg); return invokeExactConstructor(klass, args); }
/** * <p>Convenience method returning new instance of <code>klazz</code> using a single argument constructor. * The formal parameter type is inferred from the actual values of <code>arg</code>. * See {@link #invokeExactConstructor(Class, Object[], Class[])} for more details.</p> * * <p>The signatures should be assignment compatible.</p> * * @param <T> the type of the object to be constructed * @param klass the class to be constructed. * @param arg the actual argument. May be null (this will result in calling the default constructor). * @return new instance of <code>klazz</code> * * @throws NoSuchMethodException If the constructor cannot be found * @throws IllegalAccessException If an error occurs accessing the constructor * @throws InvocationTargetException If an error occurs invoking the constructor * @throws InstantiationException If an error occurs instantiating the class * * @see #invokeConstructor(java.lang.Class, java.lang.Object[], java.lang.Class[]) */ public static <T> T invokeConstructor(final Class<T> klass, final Object arg) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException, InstantiationException { final Object[] args = toArray(arg); return invokeConstructor(klass, args); }
/** * <p>Convenience method returning new instance of <code>klazz</code> using a single argument constructor. * The formal parameter type is inferred from the actual values of <code>arg</code>. * See {@link #invokeExactConstructor(Class, Object[], Class[])} for more details.</p> * * <p>The signatures should match exactly.</p> * * @param <T> the type of the object to be constructed * @param klass the class to be constructed. * @param arg the actual argument. May be null (this will result in calling the default constructor). * @return new instance of <code>klazz</code> * * @throws NoSuchMethodException If the constructor cannot be found * @throws IllegalAccessException If an error occurs accessing the constructor * @throws InvocationTargetException If an error occurs invoking the constructor * @throws InstantiationException If an error occurs instantiating the class * * @see #invokeExactConstructor(java.lang.Class, java.lang.Object[], java.lang.Class[]) */ public static <T> T invokeExactConstructor(final Class<T> klass, final Object arg) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException, InstantiationException { final Object[] args = toArray(arg); return invokeExactConstructor(klass, args); }
/** * <p>Convenience method returning new instance of <code>klazz</code> using a single argument constructor. * The formal parameter type is inferred from the actual values of <code>arg</code>. * See {@link #invokeExactConstructor(Class, Object[], Class[])} for more details.</p> * * <p>The signatures should be assignment compatible.</p> * * @param <T> the type of the object to be constructed * @param klass the class to be constructed. * @param arg the actual argument. May be null (this will result in calling the default constructor). * @return new instance of <code>klazz</code> * * @throws NoSuchMethodException If the constructor cannot be found * @throws IllegalAccessException If an error occurs accessing the constructor * @throws InvocationTargetException If an error occurs invoking the constructor * @throws InstantiationException If an error occurs instantiating the class * * @see #invokeConstructor(java.lang.Class, java.lang.Object[], java.lang.Class[]) */ public static <T> T invokeConstructor(final Class<T> klass, final Object arg) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException, InstantiationException { final Object[] args = toArray(arg); return invokeConstructor(klass, args); }
/** * <p>Convenience method returning new instance of <code>klazz</code> using a single argument constructor. * The formal parameter type is inferred from the actual values of <code>arg</code>. * See {@link #invokeExactConstructor(Class, Object[], Class[])} for more details.</p> * * <p>The signatures should match exactly.</p> * * @param <T> the type of the object to be constructed * @param klass the class to be constructed. * @param arg the actual argument. May be null (this will result in calling the default constructor). * @return new instance of <code>klazz</code> * * @throws NoSuchMethodException If the constructor cannot be found * @throws IllegalAccessException If an error occurs accessing the constructor * @throws InvocationTargetException If an error occurs invoking the constructor * @throws InstantiationException If an error occurs instantiating the class * * @see #invokeExactConstructor(java.lang.Class, java.lang.Object[], java.lang.Class[]) */ public static <T> T invokeExactConstructor(final Class<T> klass, final Object arg) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException, InstantiationException { final Object[] args = toArray(arg); return invokeExactConstructor(klass, args); }