private Action tryEmptyConstructor(final Class aClass) throws Exception { for (final Constructor constructor : aClass.getConstructors()) { final Class[] types = constructor.getParameterTypes(); if (types == null || types.length == 0) { return (Action) aClass.newInstance(); } } return null; }
public void checkNoArgueMentConstructor(Class klass) { Constructor[] constructor = klass.getConstructors(); boolean noArguement = false; for (int j = 0; j < constructor.length; j++) { Class<?>[] cklass = constructor[j].getParameterTypes(); String length = "" + cklass.length; if (!length.isEmpty()) { noArguement = true; } } if (noArguement == true) { textArea4.setText("this class does have a no arguement constructor."); } else { textArea4.setText("this class does not have a no arguement constructor."); } }