/** * generates either the plain Javadoc (if no filename specified) or the * updated file (if a filename is specified). The start and end tag for the * global info have to be specified in the file in the latter case. * * @return either the plain Javadoc or the modified file * @throws Exception in case the generation fails */ public String generate() throws Exception { if (getDir().length() == 0) { return generateJavadoc(); } else { return updateJavadoc(); } }
/** * 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; }
/** * prints the given object to System.err * * @param o the object to print */ protected void println(Object o) { if (!getSilent()) { System.err.println(o.toString()); } }
println("No start and/or end tags found: " + m_StartTag[index] + "/" + m_EndTag[index]); return content; } else { tmpStr = part.substring(part.lastIndexOf("\n") + 1); indentionLen = getIndentionLength(tmpStr); indentionStr = getIndentionString(tmpStr); part = part.substring(0, part.lastIndexOf("\n") + 1); resultBuf.append(part); resultBuf .append(indent(m_StartTag[index], indentionLen, indentionStr) + "\n"); resultBuf.append(indent(generateJavadoc(index), indentionLen, indentionStr)); resultBuf.append(indent(m_EndTag[index], indentionLen, indentionStr)); content = content.substring(content.indexOf(m_EndTag[index])); content = content.substring(m_EndTag[index].length());
/** * 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()]); }
javadoc.setOptions(options); Utils.checkForRemainingOptions(options); if (javadoc.getDir().length() == 0) { throw new Exception("No directory provided!"); + javadoc.generateHelp(); throw new Exception(result); System.out.println(javadoc.generate() + "\n"); } catch (Exception ex) { System.err.println(ex.getMessage());
file = new File(getDir() + "/" + getClassname().replaceAll("\\.", "/") + ".java"); if (!file.exists()) { println("File '" + file.getAbsolutePath() + "' doesn't exist!"); return result; result = updateJavadoc(contentBuf.toString()); } catch (Exception e) { e.printStackTrace();
/** * Gets the current settings of this object. * * @return an array of strings suitable for passing to setOptions */ @Override public String[] getOptions() { Vector<String> result = new Vector<String>(); Collections.addAll(result, super.getOptions()); if (!getProlog()) { result.add("-noprolog"); } return result.toArray(new String[result.size()]); }
/** * 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; }
/** * generates and returns the Javadoc * * @return the generated Javadoc * @throws Exception in case the generation fails */ protected String generateJavadoc() throws Exception { String result; int i; result = ""; for (i = 0; i < m_StartTag.length; i++) { if (i > 0) { result += "\n\n"; } result += generateJavadoc(i).trim(); } return result; }
println("No start and/or end tags found: " + m_StartTag[index] + "/" + m_EndTag[index]); return content; } else { tmpStr = part.substring(part.lastIndexOf("\n") + 1); indentionLen = getIndentionLength(tmpStr); indentionStr = getIndentionString(tmpStr); part = part.substring(0, part.lastIndexOf("\n") + 1); resultBuf.append(part); resultBuf .append(indent(m_StartTag[index], indentionLen, indentionStr) + "\n"); resultBuf.append(indent(generateJavadoc(index), indentionLen, indentionStr)); resultBuf.append(indent(m_EndTag[index], indentionLen, indentionStr)); content = content.substring(content.indexOf(m_EndTag[index])); content = content.substring(m_EndTag[index].length());
/** * 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()]); }
javadoc.setOptions(options); Utils.checkForRemainingOptions(options); if (javadoc.getDir().length() == 0) { throw new Exception("No directory provided!"); + javadoc.generateHelp(); throw new Exception(result); System.out.println(javadoc.generate() + "\n"); } catch (Exception ex) { System.err.println(ex.getMessage());
file = new File(getDir() + "/" + getClassname().replaceAll("\\.", "/") + ".java"); if (!file.exists()) { println("File '" + file.getAbsolutePath() + "' doesn't exist!"); return result; result = updateJavadoc(contentBuf.toString()); } catch (Exception e) { e.printStackTrace();
/** * Gets the current settings of this object. * * @return an array of strings suitable for passing to setOptions */ @Override public String[] getOptions() { Vector<String> result = new Vector<String>(); Collections.addAll(result, super.getOptions()); if (!getProlog()) { result.add("-noprolog"); } return result.toArray(new String[result.size()]); }
/** * 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; }
/** * generates and returns the Javadoc * * @return the generated Javadoc * @throws Exception in case the generation fails */ protected String generateJavadoc() throws Exception { String result; int i; result = ""; for (i = 0; i < m_StartTag.length; i++) { if (i > 0) { result += "\n\n"; } result += generateJavadoc(i).trim(); } return result; }
/** * generates either the plain Javadoc (if no filename specified) or the * updated file (if a filename is specified). The start and end tag for the * global info have to be specified in the file in the latter case. * * @return either the plain Javadoc or the modified file * @throws Exception in case the generation fails */ public String generate() throws Exception { if (getDir().length() == 0) { return generateJavadoc(); } else { return updateJavadoc(); } }
/** * 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; String[] options; int i; result = new Vector<String>(); options = super.getOptions(); for (i = 0; i < options.length; i++) { result.add(options[i]); } if (!getProlog()) { result.add("-noprolog"); } return result.toArray(new String[result.size()]); }