/** * Builds an object for provided class. * * @param newClass class to construct * @param mode argument type * @param <T> The type of the class we're trying to build, so that we can return it typesafely * * @return constructed object * @throws InstantiationException if the class cannot be instantiated */ public <T> T constructObject(Class<T> newClass, Args mode) throws InstantiationException { return constructObject(newClass, mode, new Stack<>()); }
/** * Builds an object for provided class. * * @param newClass class to construct * @param mode argument type * @param <T> The type of the class we're trying to build, so that we can return it typesafely * * @return constructed object * @throws InstantiationException if the class cannot be instantiated */ public <T> T constructObject(Class<T> newClass, Args mode) throws InstantiationException { return constructObject(newClass, mode, new Stack<>()); }
try { @SuppressWarnings("unchecked") T arg = constructObject((Class<T>) subclass, mode, stack); if (arg != null) { return arg;
try { @SuppressWarnings("unchecked") T arg = constructObject((Class<T>) subclass, mode, stack); if (arg != null) { return arg;
} catch (Throwable ignored) { try { arg = constructObject(cls, mode, stack); } catch (Throwable e2) { if (mode == Args.VALUES) {
} catch (Throwable ignored) { try { arg = constructObject(cls, mode, stack); } catch (Throwable e2) { if (mode == Args.VALUES) {