Content deleted Content added
m fixing lint errors |
m added a link to Template:Javadoc as well |
||
(9 intermediate revisions by 5 users not shown) | |||
Line 1:
{{Documentation subpage}}
<!-- PLEASE ADD CATEGORIES AND INTERWIKIS AT THE BOTTOM OF THIS PAGE -->
{{nosubst}}
Template for creating an external link into the [[Javadoc]] for a class in the current version of the [[Java SE]] API. This template should be used instead of an explicit URL to allow the link to be automatically updated to the latest API when this template is updated.
Please update [[Template:Javadoc:SE/Home_URL]] to update the Java version that this link sends users to.
If you would prefer to include a link to the javadocs of a specified version of Java, see [[Template:Javadoc]] (supports versions from JDK 11).
== Usage ==
Line 14 ⟶ 15:
! '''Type this''' !! '''To get this'''
|-
| <
|-
| <
| {{Javadoc:SE|java/lang|Object}}
|-
| <
| {{Javadoc:SE|java/lang|Object|clone()}}
|-
| <
| {{Javadoc:SE|package=java.lang|java/lang}}
|-
| <
| {{Javadoc:SE|package=java.lang|java/lang|Object}}
|-
| <
| {{Javadoc:SE|package=java.lang|java/lang|Object|clone()}}
|-
| <syntaxhighlight lang="wikitext" inline>{{Javadoc:SE|jdk/javadoc/doclet|StandardDoclet|module=jdk.javadoc}}</syntaxhighlight>
| {{Javadoc:SE|jdk/javadoc/doclet|StandardDoclet|module=jdk.javadoc}}
|}
In the above example, <
The Javadoc URLs don't include the [[generic programming|generic]] parameterized types. To get the type parameters to display, specify a <
:{| class="wikitable"
! '''Type this''' !! '''To get this'''
|-
| <
| {{Javadoc:SE|class=Class<T>|java/lang|Class}}
|-
| <syntaxhighlight lang="wikitext">{{Javadoc:SE|class=Class<T>|
member=asSubclass(Class<U>)|
java/lang|Class|asSubclass(java.lang.Class)}}</syntaxhighlight>
| {{Javadoc:SE|class=Class<T>|member=asSubclass(Class<U>)|java/lang|Class|asSubclass(java.lang.Class)}}
|-
| <
java/lang|Class}}</syntaxhighlight>
| {{Javadoc:SE|package=java.lang|class=Class<T>|java/lang|Class}}
|-
| <
member=asSubclass(Class<U>)|
java/lang|Class|asSubclass(java.lang.Class)}}</syntaxhighlight>
| {{Javadoc:SE|package=java.lang|class=Class<T>|member=asSubclass(Class<U>)|java/lang|Class|asSubclass(java.lang.Class)}}
|}
The URL to a method uses the fully-qualified path name of the parameter types. The <
Finally, if none of the above work for the displayed text, supplying a <
:{| class="wikitable"
! '''Type this''' !! '''To get this'''
|-
| <
| {{Javadoc:SE|name=out|java/lang|System|out}}
|}
Line 69 ⟶ 78:
! '''Type this''' !! '''To get this'''
|-
| <
| {{Javadoc:SE|member=indexOf(int, int)|java/lang|String|indexOf(int,%20int)}}
|}
Line 76 ⟶ 85:
! '''Type this''' !! '''To get this'''
|-
| <
| {{Javadoc:SE|member=indexOf(int, int)|java/lang|String|indexOf(int,int)}}
|}
# Including square brackets ([, ]) in the parameter types of method or constructor member arguments seems to break the template. Instead, replace square brackets with their [[numeric character reference]] escape codes, &
::{| class="wikitable"
! '''Type this''' !! '''To get this'''
|-
| <
| {{Javadoc:SE|java/util|Arrays|sort(java.lang.Object[])}}
|-
| <
| {{Javadoc:SE | member=sort(Object[])|java/util|Arrays|sort(java.lang.Object[])}}
|}
# Anything which is '''not''' within the [{{Javadoc:SE/Home_URL}}java.base/module-summary.html <code>java.base</code>] module of the Java API '''must''' declare the <code>module</code> parameter to ensure that the user is sent to the correct area of the documentation. If <code>module</code> is not specified, the template will default to <code>java.base</code> - which, if the item in question is not within <code>java.base</code>, will send the reader to a 404 page.
::{| class="wikitable"
! '''Type this''' !! '''To get this'''
|-
| <syntaxhighlight lang="wikitext" inline>{{Javadoc:SE|jdk/javadoc/doclet|StandardDoclet|module=jdk.javadoc}}</syntaxhighlight>
| {{Javadoc:SE|jdk/javadoc/doclet|StandardDoclet|module=jdk.javadoc}}
|-
| <syntaxhighlight lang="wikitext" inline>{{Javadoc:SE|java/awt|Graphics2D|module=java.desktop}}</syntaxhighlight>
| {{Javadoc:SE|java/awt|Graphics2D|module=java.desktop}}
|}
Line 95 ⟶ 114:
* [[Template:Javadoc:EE]]
* [[Template:Javadoc:Android]]
* [[Template:Javadoc:SE/Home_URL]]
<includeonly>{{Sandbox other||
<!-- CATEGORIES AND INTERWIKIS HERE, THANKS -->
Line 107 ⟶ 127:
[[ru:Шаблон:Javadoc:SE]]
}}</includeonly>
|