Package com.sun.javadoc

Examples of com.sun.javadoc.SourcePosition


  public boolean isInlineTag() {
    return true;
  }

  public String toString(Tag tag) {
    SourcePosition position = LinkResolver.resolveLink(tag,
        new ExtraClassResolver() {
          public ClassDoc findClass(String className) {
            return GWTJavaDoclet.root.classNamed(className);
          }
        });
View Full Code Here


         for (ClassDoc classDoc : rootDoc.classes())
         {
            // classDoc.setRawCommentText( classDoc.getRawCommentText() +
            // "\n@author Christian Peter Bauer");

            SourcePosition position = classDoc.position();
            if (position != null)
            {
               System.out.println("found file " + position.file());
               JavaFileParser parser = new JavaFileParser(position.file()
                     .getCanonicalPath());
               boostClassDoc(classDoc, parser.getClass(classDoc.name()), parser);
               parser.close();
            } else
               System.out.println("no file found");
View Full Code Here

   * @return the sourcecode
   */
  public String getSourcecode(MethodDoc method) throws Exception{
    //TODO improvement: There is a tree field in the doc with the code in it. May be that can be used.
    //Be aware that when no constructor is declared a default constructor is created including source code 
    SourcePosition start = method.position();
    ClassDoc classDoc = method.containingClass();
   
    int startline = start.line();
    int endline = -1;
    boolean foundMethod = false;
    for (MethodDoc methoddoc: classDoc.methods()){
      if (foundMethod){
        endline = methoddoc.position().line();
View Full Code Here

    int constructorcount = constructor.containingClass().constructors().length;
    if (constructorcount > 1)
      return false;
   
   
    SourcePosition sourcecodePosition = constructor.position();
    ClassOrInterfaceSource source =  new DocUtils().getSourceFile(sourcecodePosition.file());
    String declarationLine = source.getSourcecode(sourcecodePosition.line(), sourcecodePosition.line() +1);
    for (String word: declarationLine.split("\\s")) {//whitespace
      if ("class".equals(word)) //then the line is probable the class definition line
        return true;
    }
   
View Full Code Here

   * @return the sourcecode
   */
  public String getSourcecode(MethodDoc method) throws Exception{
    //TODO improvement: There is a tree field in the doc with the code in it. May be that can be used.
    //Be aware that when no constructor is declared a default constructor is created including source code 
    SourcePosition start = method.position();
    // Be aware that the position of the method does not include comments
    // and Annotations.

    ClassDoc classDoc = method.containingClass();
   
    int startline = start.line();
    int endline = -1;
    boolean foundMethod = false;
    for (MethodDoc methoddoc: classDoc.methods()){
      if (foundMethod){
        endline = methoddoc.position().line();
View Full Code Here

    int constructorcount = constructor.containingClass().constructors().length;
    if (constructorcount > 1)
      return false;
   
   
    SourcePosition sourcecodePosition = constructor.position();
    ClassOrInterfaceSource source =  new DocBoostUtils().getSourceFile(sourcecodePosition.file());
    String declarationLine = source.getSourcecode(sourcecodePosition.line(), sourcecodePosition.line() +1);
    for (String word: declarationLine.split("\\s")) {//whitespace
      if ("class".equals(word)) //then the line is probable the class definition line
        return true;
    }
   
View Full Code Here

            }
            doc.setRawCommentText(buf.toString());
        }
        catch ( final ParserRuntimeException e ) {
            if ( doc instanceof RootDoc ) {
                printError(new SourcePosition() {
                    @Override
                    public File file() {
                        return options.getOverviewFile();
                    }
                    @Override
View Full Code Here

    if (!isWarnOn(warning))
      return;
    if (referenced.isIncluded())
      return;
    // test, if source is available
    SourcePosition position = referenced.position();
    if (position == null || position.file() == null || position.line() == 0) {
      // no position, no source, no warning
      // getErrorReporter().printNotice(doc.position(), "reference to
      // "+referenced+" at "+position);
      return;
    }
View Full Code Here

    /* (non-Javadoc)
     * @see de.kruis.padoclet.FilterDocletBase.HandlerBase#debug(java.lang.String)
     */
    protected void debug(String message) {
      SourcePosition position = ((Doc)(this.getInvocationTarget())).position();
      FilterDocletBase pad = (FilterDocletBase) getHDPStateUserObject();
      pad.getErrorReporter().printNotice(position,message);
    }
View Full Code Here

            }
            doc.setRawCommentText(buf.toString());
        }
        catch ( final ParserRuntimeException e ) {
            if ( doc instanceof RootDoc ) {
                printError(new SourcePosition() {
                    @Override
                    public File file() {
                        return options.getOverviewFile();
                    }
                    @Override
View Full Code Here

TOP

Related Classes of com.sun.javadoc.SourcePosition

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.