/** * Returns a new instance of the class * * @return a new instance of the class */ protected Object getInstance() { Object result; Class<?> cls; result = null; try { cls = Class.forName(getClassname()); result = cls.newInstance(); } catch (Exception e) { result = null; } return result; }
/** * Returns a new instance of the class * * @return a new instance of the class */ protected Object getInstance() { Object result; Class<?> cls; result = null; try { cls = Class.forName(getClassname()); result = cls.newInstance(); } catch (Exception e) { result = null; } return result; }
/** * returns true if the class can be instantiated, i.e., has a default * constructor. * * @return true if the class can be instantiated */ protected boolean canInstantiateClass() { boolean result; Class<?> cls; result = true; cls = null; try { cls = Class.forName(getClassname()); } catch (Exception e) { result = false; println("Cannot instantiate '" + getClassname() + "'! Class in CLASSPATH?"); } if (result) { try { cls.newInstance(); } catch (Exception e) { result = false; println("Cannot instantiate '" + getClassname() + "'! Missing default constructor?"); } } return result; }
/** * returns true if the class can be instantiated, i.e., has a default * constructor. * * @return true if the class can be instantiated */ protected boolean canInstantiateClass() { boolean result; Class<?> cls; result = true; cls = null; try { cls = Class.forName(getClassname()); } catch (Exception e) { result = false; println("Cannot instantiate '" + getClassname() + "'! Class in CLASSPATH?"); } if (result) { try { cls.newInstance(); } catch (Exception e) { result = false; println("Cannot instantiate '" + getClassname() + "'! Missing default constructor?"); } } return result; }
/** * Gets the current settings of this object. * * @return an array of strings suitable for passing to setOptions */ @Override public String[] getOptions() { Vector<String> result; result = new Vector<String>(); result.add("-W"); result.add(getClassname()); if (!getUseStars()) { result.add("-nostars"); } if (getDir().length() != 0) { result.add("-dir"); result.add(getDir()); } if (getSilent()) { result.add("-silent"); } return result.toArray(new String[result.size()]); }
/** * Gets the current settings of this object. * * @return an array of strings suitable for passing to setOptions */ @Override public String[] getOptions() { Vector<String> result; result = new Vector<String>(); result.add("-W"); result.add(getClassname()); if (!getUseStars()) { result.add("-nostars"); } if (getDir().length() != 0) { result.add("-dir"); result.add(getDir()); } if (getSilent()) { result.add("-silent"); } return result.toArray(new String[result.size()]); }
file = new File(getDir() + "/" + getClassname().replaceAll("\\.", "/") + ".java"); if (!file.exists()) {
file = new File(getDir() + "/" + getClassname().replaceAll("\\.", "/") + ".java"); if (!file.exists()) {