user1418973
user1418973

Reputation: 105

javadoc parameter without package name

Basically, eclipse export javadoc output format such as:


    Method
    Modifier and type        Method and description
    java.lang.String         getData(java.lang.String key)
    java.lang.String         echo(java.lang.String string) 
    ...

If i wanna another format such as:

    Method
    Modifier and type        Method and description
    String                   getData(String key)
    String                   echo(String string) 
    ...

(without package name)

what should i do in the eclipse javadoc Extra javadoc options item? many thanks.

Upvotes: 10

Views: 4379

Answers (4)

Kana
Kana

Reputation: 366

Valid -link options automatically discard the verbose package names, replacing them with corresponding links. For friendlier documentation, probably one should avoid using -noqualifier directly if there is existing documentation online to link to.

I found this example for Gradle in reactor-core/gradle/javadoc.gradle (with modifications).

ext {
    jdk = JavaVersion.current().majorVersion
    jdkJavadoc = "https://docs.oracle.com/javase/$jdk/docs/api/"
    if (JavaVersion.current().isJava11Compatible()) {
        jdkJavadoc = "https://docs.oracle.com/en/java/javase/$jdk/docs/api/"
    }
    println "JDK Javadoc link for this build is ${rootProject.jdkJavadoc}"
}

javadoc {
    // other options

    options.links([rootProject.jdkJavadoc,
                   /* Or any other libraries you use. An example using javadoc.io:
                    * 'https://javadoc.io/doc/party.iroiro/reactor-locks/latest/'
                    */
                   'https://www.reactive-streams.org/reactive-streams-1.0.3-javadoc/',
                   'https://projectreactor.io/docs/core/release/api/'] as String[])

    // other options
}

Project Reactor is licensed under the Apache License

Upvotes: 0

JeremyDouglass
JeremyDouglass

Reputation: 1481

For Ant you can also remove qualifiers from package names when using Ant's javadoc task to define javadoc output via build.xml.

noqualifier is an attribute of <javadoc> that takes either "all" or a colon-separated list of qualifiers to remove. Here is an example,

An Ant build.xml example line that removes Javadoc qualifiers from java.lang, java.io, and java.util will look something like this:

<javadoc sourcepath="${src.dir}" destdir="${doc.dir}"
         classpathref="compile.classpath" access="public"
         noqualifier="java.lang:java.io:java.util"/>

Upvotes: 0

Daniel Vimont
Daniel Vimont

Reputation: 31

For those using Maven (and the maven-javadoc-plugin), here is an example of specifying "noqualifier" and "links" for the javadocs plugin (within the project's pom.xml file).

<build>
  <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-javadoc-plugin</artifactId>
        <version>2.10.3</version>
        <configuration>
          <noqualifier>all</noqualifier>
          <links>
            <link>http://hbase.apache.org/apidocs/</link>
            <link>http://docs.oracle.com/javase/7/docs/api/</link>
          </links>
        </configuration>
        <executions>
          <execution>
            <id>javadocs</id>
            <phase>package</phase>
            <goals>
              <goal>javadoc</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
  </plugins>
</build>

Documentation on the "noqualifier" parameter is very succinct, and can be found here: https://maven.apache.org/plugins/maven-javadoc-plugin/javadoc-mojo.html#noqualifier

Full documentation on the "links" parameter is available here: https://maven.apache.org/plugins/maven-javadoc-plugin/examples/links-configuration.html

Upvotes: 1

Paŭlo Ebermann
Paŭlo Ebermann

Reputation: 74750

I'm not sure how one does configure this in Eclipse, but the standard doclet has the -noqualifier option.

If you don't want any package names to be shown, you can use -noqualifier all, if you only want some package names to be omitted, you can list these, like this: -noqualifier java.lang:java.io.

Note then in these cases it is a good idea to also have a -link or -linkoffline option linking to the documentation of these classes, so readers have a chance to find out which class is meant here.

Upvotes: 15

Related Questions