2012-04-29 14 views
12

Hãy nói ví dụ mà tôi muốn liên kết java.lang.Double của bằng phương pháp sử dụng một thẻ html:marker @see, liên kết các lớp học các phương pháp khác

@see <a href="http://docs.oracle.com/javase/1.4.2/docs/api/java/lang/Double.html#equals(java.lang.Object)"> 

này là ok, nhưng tôi đã không hiểu thế nào để liên kết một lớp không chuẩn.
Ví dụ tôi đang phát triển hai lớp, tên là AbstractVehicle và Vehicle.But không có tài liệu javadoc của AbstractVehicle vì tài liệu của nó vẫn được tạo.
Sau đó, làm cách nào để liên kết phương pháp hoặc tham chiếu lớp học của nó? Xem xét việc này:

@see mypackage.AbstractVehilce 

này không đặt URL lớp, tôi sẽ biết làm thế nào để có được địa chỉ URL hoặc đó là tài liệu tham khảo trước khi tạo tài liệu.
Tôi hy vọng rằng câu hỏi là rõ ràng, cho tôi biết cách khác.

Trả lời

12

Để tạo một link cho một lớp cụ thể, bạn có thể sử dụng thẻ {@link mypackage.AbstractVehicle}. Tương tự, bạn có thể sử dụng {@link mypackage.AbstractVehicle#someMethod} để tạo liên kết đến someMethod() trong lớp AbstractVehicle.

Các đề xuất javadoc khác có thể được tìm thấy tại trang javadoc - The Java API Documentation Generator của Oracle.

+0

Tên gói đầy đủ cần được chỉ định nếu JavaDoc được thêm vào một lớp khác trong cùng một gói? –

3

Trang man dành cho javadoc giải thích -link-linkoffline kiểm soát cách liên kết được tạo cho các gói không được chuyển đến javadoc.

-link extdocURL 
      Creates links to existing javadoc-generated documentation 
      of external referenced classes. It takes one argument. 

      extdocURL is the absolute or relative URL of the directory 
      containing the external javadoc-generated documentation 
      you want to link to. Examples are shown below. The pack- 
      age-list file must be found in this directory (otherwise, 
      use -linkoffline). The Javadoc tool reads the package 
      names from the package-list file and then links to those 
      packages at that URL. When the Javadoc tool is run, the 
      extdocURL value is copied literally into the <A HREF> 
      links that are created. Therefore, extdocURL must be the 
      URL to the directory, not to a file. 

      You can use an absolute link for extdocURL to enable your 
      docs to link to a document on any website, or can use a 
      relative link to link only to a relative location. If rel- 
      ative, the value you pass in should be the relative path 
      from the destination directory (specified with -d) to the 
      directory containing the packages being linked to. 

      When specifying an absolute link you normally use an http: 
      link. However, if you want to link to a file system that 
      has no web server, you can use a file: link - however, do 
      this only if everyone wanting to access the generated doc- 
      umentation shares the same file system. 

      You can specify multiple -link options in a given javadoc 
      run to link to multiple documents. 

      Choosing between -linkoffline and -link - One or the other 
      option is appropriate when linking to an API document that 
      is external to the current javadoc run. 

      Use -link: when using a relative path to the external API 
      document, or when using an absolute URL to the external 
      API document, if you shell does not allow a program to 
      open a connection to that URL for reading. 

      Use -linkoffline : when using an absolute URL to the 
      external API document, if your shell does not allow a pro- 
      gram to open a connection to that URL for reading. This 
      can occur if you are behind a firewall and the document 
      you want to link to is on the other side. 

      ... 

và trong khi -link đòi hỏi bạn phải có mạng kết nối khi bạn tạo ra các tài liệu hướng dẫn để nó có thể lấy danh sách các gói qua mạng, -linkoffline không nhưng đòi hỏi bạn phải cung cấp danh sách các gói tự hỏi:

-linkoffline extdocURL packagelistLoc 
      This option is a varition of -link; they both create links 
      to javadoc-generated documentation for external referenced 
      classes. Use the -linkoffline option when linking to a 
      document on the web when the Javadoc tool itself is 
      "offline" - that is, it cannot access the document through 
      a web connection. 

      ... 
2

Những gì bạn có thể đặt sau @see được mô tả trong javadoc tool documentation. Bạn không bao giờ nên đặt URL của bất kỳ tài liệu phương thức hoặc lớp bên ngoài nào. Thay vào đó, bạn nên đặt tên lớp/phương thức và sử dụng -link option để cho phép javadoc tìm ra URL thích hợp cho bạn.

Các vấn đề liên quan