com.sun.beans.finder.ConstructorFinder Java Examples
The following examples show how to use
com.sun.beans.finder.ConstructorFinder.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TestConstructorFinder.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) throws Exception { List<Class<?>> classes = Task.getClasses(Integer.MAX_VALUE); List<Constructor> constructors = new ArrayList<>(); for (Class<?> type : classes) { Collections.addAll(constructors, type.getConstructors()); } Task.print("found " + constructors.size() + " constructors in " + classes.size() + " classes"); List<Task> tasks = new ArrayList<>(); for (int i = 0; i < 50; i++) { tasks.add(new Task<Constructor>(constructors) { @Override protected void process(Constructor constructor) throws NoSuchMethodException { ConstructorFinder.findConstructor(constructor.getDeclaringClass(), constructor.getParameterTypes()); } }); } int alarm = 0; while (true) { int alive = 0; int working = 0; for (Task task : tasks) { if (task.isWorking()) { working++; alive++; } else if (task.isAlive()) { alive++; } } if (alive == 0) { break; } Task.print(working + " out of " + alive + " threads are working"); if ((working == 0) && (++alarm == 10)) { Task.print("DEADLOCK DETECTED"); System.exit(100); } Thread.sleep(1000); } }
Example #2
Source File: TestConstructorFinder.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) throws Exception { List<Class<?>> classes = Task.getClasses(Integer.MAX_VALUE); List<Constructor> constructors = new ArrayList<>(); for (Class<?> type : classes) { Collections.addAll(constructors, type.getConstructors()); } Task.print("found " + constructors.size() + " constructors in " + classes.size() + " classes"); List<Task> tasks = new ArrayList<>(); for (int i = 0; i < 50; i++) { tasks.add(new Task<Constructor>(constructors) { @Override protected void process(Constructor constructor) throws NoSuchMethodException { ConstructorFinder.findConstructor(constructor.getDeclaringClass(), constructor.getParameterTypes()); } }); } int alarm = 0; while (true) { int alive = 0; int working = 0; for (Task task : tasks) { if (task.isWorking()) { working++; alive++; } else if (task.isAlive()) { alive++; } } if (alive == 0) { break; } Task.print(working + " out of " + alive + " threads are working"); if ((working == 0) && (++alarm == 10)) { Task.print("DEADLOCK DETECTED"); System.exit(100); } Thread.sleep(1000); } }
Example #3
Source File: TestConstructorFinder.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) throws Exception { List<Class<?>> classes = Task.getClasses(Integer.MAX_VALUE); List<Constructor> constructors = new ArrayList<>(); for (Class<?> type : classes) { Collections.addAll(constructors, type.getConstructors()); } Task.print("found " + constructors.size() + " constructors in " + classes.size() + " classes"); List<Task> tasks = new ArrayList<>(); for (int i = 0; i < 50; i++) { tasks.add(new Task<Constructor>(constructors) { @Override protected void process(Constructor constructor) throws NoSuchMethodException { ConstructorFinder.findConstructor(constructor.getDeclaringClass(), constructor.getParameterTypes()); } }); } int alarm = 0; while (true) { int alive = 0; int working = 0; for (Task task : tasks) { if (task.isWorking()) { working++; alive++; } else if (task.isAlive()) { alive++; } } if (alive == 0) { break; } Task.print(working + " out of " + alive + " threads are working"); if ((working == 0) && (++alarm == 10)) { Task.print("DEADLOCK DETECTED"); System.exit(100); } Thread.sleep(1000); } }
Example #4
Source File: TestConstructorFinder.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) throws Exception { List<Class<?>> classes = Task.getClasses(Integer.MAX_VALUE); List<Constructor> constructors = new ArrayList<>(); for (Class<?> type : classes) { Collections.addAll(constructors, type.getConstructors()); } Task.print("found " + constructors.size() + " constructors in " + classes.size() + " classes"); List<Task> tasks = new ArrayList<>(); for (int i = 0; i < 50; i++) { tasks.add(new Task<Constructor>(constructors) { @Override protected void process(Constructor constructor) throws NoSuchMethodException { ConstructorFinder.findConstructor(constructor.getDeclaringClass(), constructor.getParameterTypes()); } }); } int alarm = 0; while (true) { int alive = 0; int working = 0; for (Task task : tasks) { if (task.isWorking()) { working++; alive++; } else if (task.isAlive()) { alive++; } } if (alive == 0) { break; } Task.print(working + " out of " + alive + " threads are working"); if ((working == 0) && (++alarm == 10)) { Task.print("DEADLOCK DETECTED"); System.exit(100); } Thread.sleep(1000); } }
Example #5
Source File: TestConstructorFinder.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) throws Exception { List<Class<?>> classes = Task.getClasses(Integer.MAX_VALUE); List<Constructor> constructors = new ArrayList<>(); for (Class<?> type : classes) { Collections.addAll(constructors, type.getConstructors()); } Task.print("found " + constructors.size() + " constructors in " + classes.size() + " classes"); List<Task> tasks = new ArrayList<>(); for (int i = 0; i < 50; i++) { tasks.add(new Task<Constructor>(constructors) { @Override protected void process(Constructor constructor) throws NoSuchMethodException { ConstructorFinder.findConstructor(constructor.getDeclaringClass(), constructor.getParameterTypes()); } }); } int alarm = 0; while (true) { int alive = 0; int working = 0; for (Task task : tasks) { if (task.isWorking()) { working++; alive++; } else if (task.isAlive()) { alive++; } } if (alive == 0) { break; } Task.print(working + " out of " + alive + " threads are working"); if ((working == 0) && (++alarm == 10)) { Task.print("DEADLOCK DETECTED"); System.exit(100); } Thread.sleep(1000); } }
Example #6
Source File: TestConstructorFinder.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) throws Exception { List<Class<?>> classes = Task.getClasses(Integer.MAX_VALUE); List<Constructor> constructors = new ArrayList<>(); for (Class<?> type : classes) { Collections.addAll(constructors, type.getConstructors()); } Task.print("found " + constructors.size() + " constructors in " + classes.size() + " classes"); List<Task> tasks = new ArrayList<>(); for (int i = 0; i < 50; i++) { tasks.add(new Task<Constructor>(constructors) { @Override protected void process(Constructor constructor) throws NoSuchMethodException { ConstructorFinder.findConstructor(constructor.getDeclaringClass(), constructor.getParameterTypes()); } }); } int alarm = 0; while (true) { int alive = 0; int working = 0; for (Task task : tasks) { if (task.isWorking()) { working++; alive++; } else if (task.isAlive()) { alive++; } } if (alive == 0) { break; } Task.print(working + " out of " + alive + " threads are working"); if ((working == 0) && (++alarm == 10)) { Task.print("DEADLOCK DETECTED"); System.exit(100); } Thread.sleep(1000); } }
Example #7
Source File: TestConstructorFinder.java From hottub with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) throws Exception { List<Class<?>> classes = Task.getClasses(Integer.MAX_VALUE); List<Constructor> constructors = new ArrayList<>(); for (Class<?> type : classes) { Collections.addAll(constructors, type.getConstructors()); } Task.print("found " + constructors.size() + " constructors in " + classes.size() + " classes"); List<Task> tasks = new ArrayList<>(); for (int i = 0; i < 50; i++) { tasks.add(new Task<Constructor>(constructors) { @Override protected void process(Constructor constructor) throws NoSuchMethodException { ConstructorFinder.findConstructor(constructor.getDeclaringClass(), constructor.getParameterTypes()); } }); } int alarm = 0; while (true) { int alive = 0; int working = 0; for (Task task : tasks) { if (task.isWorking()) { working++; alive++; } else if (task.isAlive()) { alive++; } } if (alive == 0) { break; } Task.print(working + " out of " + alive + " threads are working"); if ((working == 0) && (++alarm == 10)) { Task.print("DEADLOCK DETECTED"); System.exit(100); } Thread.sleep(1000); } }
Example #8
Source File: TestConstructorFinder.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) throws Exception { List<Class<?>> classes = Task.getClasses(Integer.MAX_VALUE); List<Constructor> constructors = new ArrayList<>(); for (Class<?> type : classes) { Collections.addAll(constructors, type.getConstructors()); } Task.print("found " + constructors.size() + " constructors in " + classes.size() + " classes"); List<Task> tasks = new ArrayList<>(); for (int i = 0; i < 50; i++) { tasks.add(new Task<Constructor>(constructors) { @Override protected void process(Constructor constructor) throws NoSuchMethodException { ConstructorFinder.findConstructor(constructor.getDeclaringClass(), constructor.getParameterTypes()); } }); } int alarm = 0; while (true) { int alive = 0; int working = 0; for (Task task : tasks) { if (task.isWorking()) { working++; alive++; } else if (task.isAlive()) { alive++; } } if (alive == 0) { break; } Task.print(working + " out of " + alive + " threads are working"); if ((working == 0) && (++alarm == 10)) { Task.print("DEADLOCK DETECTED"); System.exit(100); } Thread.sleep(1000); } }
Example #9
Source File: TestConstructorFinder.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) throws Exception { List<Class<?>> classes = Task.getClasses(Integer.MAX_VALUE); List<Constructor> constructors = new ArrayList<>(); for (Class<?> type : classes) { Collections.addAll(constructors, type.getConstructors()); } Task.print("found " + constructors.size() + " constructors in " + classes.size() + " classes"); List<Task> tasks = new ArrayList<>(); for (int i = 0; i < 50; i++) { tasks.add(new Task<Constructor>(constructors) { @Override protected void process(Constructor constructor) throws NoSuchMethodException { ConstructorFinder.findConstructor(constructor.getDeclaringClass(), constructor.getParameterTypes()); } }); } int alarm = 0; while (true) { int alive = 0; int working = 0; for (Task task : tasks) { if (task.isWorking()) { working++; alive++; } else if (task.isAlive()) { alive++; } } if (alive == 0) { break; } Task.print(working + " out of " + alive + " threads are working"); if ((working == 0) && (++alarm == 10)) { throw new RuntimeException("FAIL - DEADLOCK DETECTED"); } Thread.sleep(1000); } }
Example #10
Source File: TestConstructorFinder.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) throws Exception { List<Class<?>> classes = Task.getClasses(Integer.MAX_VALUE); List<Constructor> constructors = new ArrayList<>(); for (Class<?> type : classes) { Collections.addAll(constructors, type.getConstructors()); } Task.print("found " + constructors.size() + " constructors in " + classes.size() + " classes"); List<Task> tasks = new ArrayList<>(); for (int i = 0; i < 50; i++) { tasks.add(new Task<Constructor>(constructors) { @Override protected void process(Constructor constructor) throws NoSuchMethodException { ConstructorFinder.findConstructor(constructor.getDeclaringClass(), constructor.getParameterTypes()); } }); } int alarm = 0; while (true) { int alive = 0; int working = 0; for (Task task : tasks) { if (task.isWorking()) { working++; alive++; } else if (task.isAlive()) { alive++; } } if (alive == 0) { break; } Task.print(working + " out of " + alive + " threads are working"); if ((working == 0) && (++alarm == 10)) { Task.print("DEADLOCK DETECTED"); System.exit(100); } Thread.sleep(1000); } }
Example #11
Source File: TestConstructorFinder.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) throws Exception { List<Class<?>> classes = Task.getClasses(Integer.MAX_VALUE); List<Constructor> constructors = new ArrayList<>(); for (Class<?> type : classes) { Collections.addAll(constructors, type.getConstructors()); } Task.print("found " + constructors.size() + " constructors in " + classes.size() + " classes"); List<Task> tasks = new ArrayList<>(); for (int i = 0; i < 50; i++) { tasks.add(new Task<Constructor>(constructors) { @Override protected void process(Constructor constructor) throws NoSuchMethodException { ConstructorFinder.findConstructor(constructor.getDeclaringClass(), constructor.getParameterTypes()); } }); } int alarm = 0; while (true) { int alive = 0; int working = 0; for (Task task : tasks) { if (task.isWorking()) { working++; alive++; } else if (task.isAlive()) { alive++; } } if (alive == 0) { break; } Task.print(working + " out of " + alive + " threads are working"); if ((working == 0) && (++alarm == 10)) { Task.print("DEADLOCK DETECTED"); System.exit(100); } Thread.sleep(1000); } }
Example #12
Source File: TestConstructorFinder.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) throws Exception { List<Class<?>> classes = Task.getClasses(Integer.MAX_VALUE); List<Constructor> constructors = new ArrayList<>(); for (Class<?> type : classes) { Collections.addAll(constructors, type.getConstructors()); } Task.print("found " + constructors.size() + " constructors in " + classes.size() + " classes"); List<Task> tasks = new ArrayList<>(); for (int i = 0; i < 50; i++) { tasks.add(new Task<Constructor>(constructors) { @Override protected void process(Constructor constructor) throws NoSuchMethodException { ConstructorFinder.findConstructor(constructor.getDeclaringClass(), constructor.getParameterTypes()); } }); } int alarm = 0; while (true) { int alive = 0; int working = 0; for (Task task : tasks) { if (task.isWorking()) { working++; alive++; } else if (task.isAlive()) { alive++; } } if (alive == 0) { break; } Task.print(working + " out of " + alive + " threads are working"); if ((working == 0) && (++alarm == 10)) { Task.print("DEADLOCK DETECTED"); System.exit(100); } Thread.sleep(1000); } }
Example #13
Source File: TestConstructorFinder.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) throws Exception { List<Class<?>> classes = Task.getClasses(Integer.MAX_VALUE); List<Constructor> constructors = new ArrayList<>(); for (Class<?> type : classes) { Collections.addAll(constructors, type.getConstructors()); } Task.print("found " + constructors.size() + " constructors in " + classes.size() + " classes"); List<Task> tasks = new ArrayList<>(); for (int i = 0; i < 50; i++) { tasks.add(new Task<Constructor>(constructors) { @Override protected void process(Constructor constructor) throws NoSuchMethodException { ConstructorFinder.findConstructor(constructor.getDeclaringClass(), constructor.getParameterTypes()); } }); } int alarm = 0; while (true) { int alive = 0; int working = 0; for (Task task : tasks) { if (task.isWorking()) { working++; alive++; } else if (task.isAlive()) { alive++; } } if (alive == 0) { break; } Task.print(working + " out of " + alive + " threads are working"); if ((working == 0) && (++alarm == 10)) { Task.print("DEADLOCK DETECTED"); System.exit(100); } Thread.sleep(1000); } }
Example #14
Source File: NewElementHandler.java From dragonwell8_jdk with GNU General Public License v2.0 | 3 votes |
/** * Calculates the value of this element * using the base class and the array of arguments. * By default, it creates an instance of the base class. * This method should be overridden in those handlers * that extend behavior of this element. * * @param type the base class * @param args the array of arguments * @return the value of this element * @throws Exception if calculation is failed */ ValueObject getValueObject(Class<?> type, Object[] args) throws Exception { if (type == null) { throw new IllegalArgumentException("Class name is not set"); } Class<?>[] types = getArgumentTypes(args); Constructor<?> constructor = ConstructorFinder.findConstructor(type, types); if (constructor.isVarArgs()) { args = getArguments(args, constructor.getParameterTypes()); } return ValueObjectImpl.create(constructor.newInstance(args)); }
Example #15
Source File: NewElementHandler.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 3 votes |
/** * Calculates the value of this element * using the base class and the array of arguments. * By default, it creates an instance of the base class. * This method should be overridden in those handlers * that extend behavior of this element. * * @param type the base class * @param args the array of arguments * @return the value of this element * @throws Exception if calculation is failed */ ValueObject getValueObject(Class<?> type, Object[] args) throws Exception { if (type == null) { throw new IllegalArgumentException("Class name is not set"); } Class<?>[] types = getArgumentTypes(args); Constructor<?> constructor = ConstructorFinder.findConstructor(type, types); if (constructor.isVarArgs()) { args = getArguments(args, constructor.getParameterTypes()); } return ValueObjectImpl.create(constructor.newInstance(args)); }
Example #16
Source File: NewElementHandler.java From TencentKona-8 with GNU General Public License v2.0 | 3 votes |
/** * Calculates the value of this element * using the base class and the array of arguments. * By default, it creates an instance of the base class. * This method should be overridden in those handlers * that extend behavior of this element. * * @param type the base class * @param args the array of arguments * @return the value of this element * @throws Exception if calculation is failed */ ValueObject getValueObject(Class<?> type, Object[] args) throws Exception { if (type == null) { throw new IllegalArgumentException("Class name is not set"); } Class<?>[] types = getArgumentTypes(args); Constructor<?> constructor = ConstructorFinder.findConstructor(type, types); if (constructor.isVarArgs()) { args = getArguments(args, constructor.getParameterTypes()); } return ValueObjectImpl.create(constructor.newInstance(args)); }
Example #17
Source File: NewElementHandler.java From jdk8u-jdk with GNU General Public License v2.0 | 3 votes |
/** * Calculates the value of this element * using the base class and the array of arguments. * By default, it creates an instance of the base class. * This method should be overridden in those handlers * that extend behavior of this element. * * @param type the base class * @param args the array of arguments * @return the value of this element * @throws Exception if calculation is failed */ ValueObject getValueObject(Class<?> type, Object[] args) throws Exception { if (type == null) { throw new IllegalArgumentException("Class name is not set"); } Class<?>[] types = getArgumentTypes(args); Constructor<?> constructor = ConstructorFinder.findConstructor(type, types); if (constructor.isVarArgs()) { args = getArguments(args, constructor.getParameterTypes()); } return ValueObjectImpl.create(constructor.newInstance(args)); }
Example #18
Source File: NewElementHandler.java From jdk8u_jdk with GNU General Public License v2.0 | 3 votes |
/** * Calculates the value of this element * using the base class and the array of arguments. * By default, it creates an instance of the base class. * This method should be overridden in those handlers * that extend behavior of this element. * * @param type the base class * @param args the array of arguments * @return the value of this element * @throws Exception if calculation is failed */ ValueObject getValueObject(Class<?> type, Object[] args) throws Exception { if (type == null) { throw new IllegalArgumentException("Class name is not set"); } Class<?>[] types = getArgumentTypes(args); Constructor<?> constructor = ConstructorFinder.findConstructor(type, types); if (constructor.isVarArgs()) { args = getArguments(args, constructor.getParameterTypes()); } return ValueObjectImpl.create(constructor.newInstance(args)); }
Example #19
Source File: NewElementHandler.java From jdk8u60 with GNU General Public License v2.0 | 3 votes |
/** * Calculates the value of this element * using the base class and the array of arguments. * By default, it creates an instance of the base class. * This method should be overridden in those handlers * that extend behavior of this element. * * @param type the base class * @param args the array of arguments * @return the value of this element * @throws Exception if calculation is failed */ ValueObject getValueObject(Class<?> type, Object[] args) throws Exception { if (type == null) { throw new IllegalArgumentException("Class name is not set"); } Class<?>[] types = getArgumentTypes(args); Constructor<?> constructor = ConstructorFinder.findConstructor(type, types); if (constructor.isVarArgs()) { args = getArguments(args, constructor.getParameterTypes()); } return ValueObjectImpl.create(constructor.newInstance(args)); }
Example #20
Source File: NewElementHandler.java From openjdk-8 with GNU General Public License v2.0 | 3 votes |
/** * Calculates the value of this element * using the base class and the array of arguments. * By default, it creates an instance of the base class. * This method should be overridden in those handlers * that extend behavior of this element. * * @param type the base class * @param args the array of arguments * @return the value of this element * @throws Exception if calculation is failed */ ValueObject getValueObject(Class<?> type, Object[] args) throws Exception { if (type == null) { throw new IllegalArgumentException("Class name is not set"); } Class<?>[] types = getArgumentTypes(args); Constructor<?> constructor = ConstructorFinder.findConstructor(type, types); if (constructor.isVarArgs()) { args = getArguments(args, constructor.getParameterTypes()); } return ValueObjectImpl.create(constructor.newInstance(args)); }
Example #21
Source File: NewElementHandler.java From openjdk-8-source with GNU General Public License v2.0 | 3 votes |
/** * Calculates the value of this element * using the base class and the array of arguments. * By default, it creates an instance of the base class. * This method should be overridden in those handlers * that extend behavior of this element. * * @param type the base class * @param args the array of arguments * @return the value of this element * @throws Exception if calculation is failed */ ValueObject getValueObject(Class<?> type, Object[] args) throws Exception { if (type == null) { throw new IllegalArgumentException("Class name is not set"); } Class<?>[] types = getArgumentTypes(args); Constructor<?> constructor = ConstructorFinder.findConstructor(type, types); if (constructor.isVarArgs()) { args = getArguments(args, constructor.getParameterTypes()); } return ValueObjectImpl.create(constructor.newInstance(args)); }
Example #22
Source File: NewElementHandler.java From openjdk-jdk8u with GNU General Public License v2.0 | 3 votes |
/** * Calculates the value of this element * using the base class and the array of arguments. * By default, it creates an instance of the base class. * This method should be overridden in those handlers * that extend behavior of this element. * * @param type the base class * @param args the array of arguments * @return the value of this element * @throws Exception if calculation is failed */ ValueObject getValueObject(Class<?> type, Object[] args) throws Exception { if (type == null) { throw new IllegalArgumentException("Class name is not set"); } Class<?>[] types = getArgumentTypes(args); Constructor<?> constructor = ConstructorFinder.findConstructor(type, types); if (constructor.isVarArgs()) { args = getArguments(args, constructor.getParameterTypes()); } return ValueObjectImpl.create(constructor.newInstance(args)); }
Example #23
Source File: NewElementHandler.java From hottub with GNU General Public License v2.0 | 3 votes |
/** * Calculates the value of this element * using the base class and the array of arguments. * By default, it creates an instance of the base class. * This method should be overridden in those handlers * that extend behavior of this element. * * @param type the base class * @param args the array of arguments * @return the value of this element * @throws Exception if calculation is failed */ ValueObject getValueObject(Class<?> type, Object[] args) throws Exception { if (type == null) { throw new IllegalArgumentException("Class name is not set"); } Class<?>[] types = getArgumentTypes(args); Constructor<?> constructor = ConstructorFinder.findConstructor(type, types); if (constructor.isVarArgs()) { args = getArguments(args, constructor.getParameterTypes()); } return ValueObjectImpl.create(constructor.newInstance(args)); }
Example #24
Source File: NewElementHandler.java From jdk8u-jdk with GNU General Public License v2.0 | 3 votes |
/** * Calculates the value of this element * using the base class and the array of arguments. * By default, it creates an instance of the base class. * This method should be overridden in those handlers * that extend behavior of this element. * * @param type the base class * @param args the array of arguments * @return the value of this element * @throws Exception if calculation is failed */ ValueObject getValueObject(Class<?> type, Object[] args) throws Exception { if (type == null) { throw new IllegalArgumentException("Class name is not set"); } Class<?>[] types = getArgumentTypes(args); Constructor<?> constructor = ConstructorFinder.findConstructor(type, types); if (constructor.isVarArgs()) { args = getArguments(args, constructor.getParameterTypes()); } return ValueObjectImpl.create(constructor.newInstance(args)); }
Example #25
Source File: NewElementHandler.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 3 votes |
/** * Calculates the value of this element * using the base class and the array of arguments. * By default, it creates an instance of the base class. * This method should be overridden in those handlers * that extend behavior of this element. * * @param type the base class * @param args the array of arguments * @return the value of this element * @throws Exception if calculation is failed */ ValueObject getValueObject(Class<?> type, Object[] args) throws Exception { if (type == null) { throw new IllegalArgumentException("Class name is not set"); } Class<?>[] types = getArgumentTypes(args); Constructor<?> constructor = ConstructorFinder.findConstructor(type, types); if (constructor.isVarArgs()) { args = getArguments(args, constructor.getParameterTypes()); } return ValueObjectImpl.create(constructor.newInstance(args)); }
Example #26
Source File: NewElementHandler.java From openjdk-jdk9 with GNU General Public License v2.0 | 3 votes |
/** * Calculates the value of this element * using the base class and the array of arguments. * By default, it creates an instance of the base class. * This method should be overridden in those handlers * that extend behavior of this element. * * @param type the base class * @param args the array of arguments * @return the value of this element * @throws Exception if calculation is failed */ ValueObject getValueObject(Class<?> type, Object[] args) throws Exception { if (type == null) { throw new IllegalArgumentException("Class name is not set"); } Class<?>[] types = getArgumentTypes(args); Constructor<?> constructor = ConstructorFinder.findConstructor(type, types); if (constructor.isVarArgs()) { args = getArguments(args, constructor.getParameterTypes()); } return ValueObjectImpl.create(constructor.newInstance(args)); }
Example #27
Source File: NewElementHandler.java From Bytecoder with Apache License 2.0 | 3 votes |
/** * Calculates the value of this element * using the base class and the array of arguments. * By default, it creates an instance of the base class. * This method should be overridden in those handlers * that extend behavior of this element. * * @param type the base class * @param args the array of arguments * @return the value of this element * @throws Exception if calculation is failed */ ValueObject getValueObject(Class<?> type, Object[] args) throws Exception { if (type == null) { throw new IllegalArgumentException("Class name is not set"); } Class<?>[] types = getArgumentTypes(args); Constructor<?> constructor = ConstructorFinder.findConstructor(type, types); if (constructor.isVarArgs()) { args = getArguments(args, constructor.getParameterTypes()); } return ValueObjectImpl.create(constructor.newInstance(args)); }