Difference between revisions of "Template:Javadoc:SE/doc"
imported>Vanisaac m (→See also: clean up per WP:CAT#T and WP:AWBREQ add template:Sandbox other) |
imported>Jonesey95 |
||
| Line 14: | Line 14: | ||
! '''Type this''' !! '''To get this''' | ! '''Type this''' !! '''To get this''' | ||
|- | |- | ||
| − | | < | + | | <code><nowiki>{{Javadoc:SE}}</nowiki></code> || {{Javadoc:SE}} |
|- | |- | ||
| − | | < | + | | <code><nowiki>{{Javadoc:SE|java/lang|Object}}</nowiki></code> |
| {{Javadoc:SE|java/lang|Object}} | | {{Javadoc:SE|java/lang|Object}} | ||
|- | |- | ||
| − | | < | + | | <code><nowiki>{{Javadoc:SE|java/lang|Object|clone()}}</nowiki></code> |
| {{Javadoc:SE|java/lang|Object|clone()}} | | {{Javadoc:SE|java/lang|Object|clone()}} | ||
|- | |- | ||
| − | | < | + | | <code><nowiki>{{Javadoc:SE|package=java.lang|java/lang}}</nowiki></code> |
| {{Javadoc:SE|package=java.lang|java/lang}} | | {{Javadoc:SE|package=java.lang|java/lang}} | ||
|- | |- | ||
| − | | < | + | | <code><nowiki>{{Javadoc:SE|package=java.lang|java/lang|Object}}</nowiki></code> |
| {{Javadoc:SE|package=java.lang|java/lang|Object}} | | {{Javadoc:SE|package=java.lang|java/lang|Object}} | ||
|- | |- | ||
| − | | < | + | | <code><nowiki>{{Javadoc:SE|package=java.lang|java/lang|Object|clone()}}</nowiki></code> |
| {{Javadoc:SE|package=java.lang|java/lang|Object|clone()}} | | {{Javadoc:SE|package=java.lang|java/lang|Object|clone()}} | ||
|} | |} | ||
| − | In the above example, < | + | In the above example, <code>clone()</code> can be any member documented in the [[Javadoc]] that isn't a class or interface, so <code><nowiki>{{Javadoc:SE|java/lang|System|out}}</nowiki></code> produces {{Javadoc:SE|java/lang|System|out}}. For a class or interface member, the class name is <code>OuterClass.InnerClass</code>, so <code><nowiki>{{Javadoc:SE|java/lang|Character.Subset}}</nowiki></code> produces {{Javadoc:SE|java/lang|Character.Subset}}. |
| − | The Javadoc URLs don't include the [[generic programming|generic]] parameterized types. To get the type parameters to display, specify a < | + | The Javadoc URLs don't include the [[generic programming|generic]] parameterized types. To get the type parameters to display, specify a <code>class</code> and/or <code>member</code> parameter to the template to override the name of the displayed class and/or member name. Note that the parameterized type notation uses angle brackets (<code><</code> and <code>></code>), so type parameter names that match [[HTML tag|HTML markup tags]] need to use the [[character encodings in HTML|character encodings]] <code>&lt;</code> for <code><</code> and <code>&gt;</code> for <code>></code>. |
:{| class="wikitable" | :{| class="wikitable" | ||
! '''Type this''' !! '''To get this''' | ! '''Type this''' !! '''To get this''' | ||
|- | |- | ||
| − | | < | + | | <code><nowiki>{{Javadoc:SE|class=Class<T>|java/lang|Class}}</nowiki></code> |
| {{Javadoc:SE|class=Class<T>|java/lang|Class}} | | {{Javadoc:SE|class=Class<T>|java/lang|Class}} | ||
|- | |- | ||
| − | | < | + | | <code><nowiki>{{Javadoc:SE|class=Class<T>|</nowiki><br /><nowiki>member=asSubclass(Class&lt;U&gt;)|</nowiki><br /><nowiki>java/lang|Class|asSubclass(java.lang.Class)}}</nowiki></code> |
| {{Javadoc:SE|class=Class<T>|member=asSubclass(Class<U>)|java/lang|Class|asSubclass(java.lang.Class)}} | | {{Javadoc:SE|class=Class<T>|member=asSubclass(Class<U>)|java/lang|Class|asSubclass(java.lang.Class)}} | ||
|- | |- | ||
| − | | < | + | | <code><nowiki>{{Javadoc:SE|package=java.lang|class=Class<T>|</nowiki><br /><nowiki>java/lang|Class}}</nowiki></code> |
| {{Javadoc:SE|package=java.lang|class=Class<T>|java/lang|Class}} | | {{Javadoc:SE|package=java.lang|class=Class<T>|java/lang|Class}} | ||
|- | |- | ||
| − | | < | + | | <code><nowiki>{{Javadoc:SE|package=java.lang|class=Class<T>|</nowiki><br /><nowiki>member=asSubclass(Class&lt;U&gt;)|</nowiki><br /><nowiki>java/lang|Class|asSubclass(java.lang.Class)}}</nowiki></code> |
| {{Javadoc:SE|package=java.lang|class=Class<T>|member=asSubclass(Class<U>)|java/lang|Class|asSubclass(java.lang.Class)}} | | {{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 < | + | The URL to a method uses the fully-qualified path name of the parameter types. The <code>member</code> parameter can be used to use the simple type name of method parameters, as shown in the preceding table, or even to eliminate the parameters entirely. |
| − | Finally, if none of the above work for the displayed text, supplying a < | + | Finally, if none of the above work for the displayed text, supplying a <code>name</code> parameter allows the entire package/class/member name displayed to be replaced. (However, the <code>name</code> parameter won't override the text displayed when using the <code><nowiki>{{Javadoc:SE}}</nowiki></code> form.) |
:{| class="wikitable" | :{| class="wikitable" | ||
! '''Type this''' !! '''To get this''' | ! '''Type this''' !! '''To get this''' | ||
|- | |- | ||
| − | | < | + | | <code><nowiki>{{Javadoc:SE|name=out|java/lang|System|out}}</nowiki></code> |
| {{Javadoc:SE|name=out|java/lang|System|out}} | | {{Javadoc:SE|name=out|java/lang|System|out}} | ||
|} | |} | ||
| Line 69: | Line 69: | ||
! '''Type this''' !! '''To get this''' | ! '''Type this''' !! '''To get this''' | ||
|- | |- | ||
| − | | < | + | | <code><nowiki>{{Javadoc:SE|member=indexOf(int, int)|java/lang|String|indexOf(int,%20int)}}</nowiki></code> |
| {{Javadoc:SE|member=indexOf(int, int)|java/lang|String|indexOf(int,%20int)}} | | {{Javadoc:SE|member=indexOf(int, int)|java/lang|String|indexOf(int,%20int)}} | ||
|} | |} | ||
| Line 76: | Line 76: | ||
! '''Type this''' !! '''To get this''' | ! '''Type this''' !! '''To get this''' | ||
|- | |- | ||
| − | | < | + | | <code><nowiki>{{Javadoc:SE|member=indexOf(int, int)|java/lang|String|indexOf(int,int)}}</nowiki></code> |
| {{Javadoc:SE|member=indexOf(int, int)|java/lang|String|indexOf(int,int)}} | | {{Javadoc:SE|member=indexOf(int, int)|java/lang|String|indexOf(int,int)}} | ||
|} | |} | ||
| Line 83: | Line 83: | ||
! '''Type this''' !! '''To get this''' | ! '''Type this''' !! '''To get this''' | ||
|- | |- | ||
| − | | < | + | | <code><nowiki>{{Javadoc:SE|java/util|Arrays|sort(java.lang.Object&#91;&#93;)}}</nowiki></code> |
| {{Javadoc:SE|java/util|Arrays|sort(java.lang.Object[])}} | | {{Javadoc:SE|java/util|Arrays|sort(java.lang.Object[])}} | ||
|- | |- | ||
| − | | < | + | | <code><nowiki>{{Javadoc:SE | member=sort(Object&#91;&#93;)|java/util|Arrays|sort(java.lang.Object&#91;&#93;)}}</nowiki></code> |
| {{Javadoc:SE | member=sort(Object[])|java/util|Arrays|sort(java.lang.Object[])}} | | {{Javadoc:SE | member=sort(Object[])|java/util|Arrays|sort(java.lang.Object[])}} | ||
|} | |} | ||
Latest revision as of 02:23, 3 June 2020
| This is a documentation subpage for Template:Javadoc:SE. It contains usage information, categories and other content that is not part of the original template page. |
| This template employs intricate features of template syntax.
You are encouraged to familiarise yourself with its setup and parser functions before editing the template. If your edit causes unexpected problems, please undo it quickly, as this template may appear on a large number of pages. You can conduct experiments, and should test all major changes, in either this template's sandbox, the general template sandbox, or your user space before changing anything here. |
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.
Do not subst this template.
Usage
These are the common forms of usage for this template:
Type this To get this {{Javadoc:SE}}Java SE 10 API Javadocs {{Javadoc:SE|java/lang|Object}}Object{{Javadoc:SE|java/lang|Object|clone()}}Object.clone(){{Javadoc:SE|package=java.lang|java/lang}}java.lang{{Javadoc:SE|package=java.lang|java/lang|Object}}java.lang.Object{{Javadoc:SE|package=java.lang|java/lang|Object|clone()}}java.lang.Object.clone()
In the above example, clone() can be any member documented in the Javadoc that isn't a class or interface, so {{Javadoc:SE|java/lang|System|out}} produces System.out. For a class or interface member, the class name is OuterClass.InnerClass, so {{Javadoc:SE|java/lang|Character.Subset}} produces Character.Subset.
The Javadoc URLs don't include the generic parameterized types. To get the type parameters to display, specify a class and/or member parameter to the template to override the name of the displayed class and/or member name. Note that the parameterized type notation uses angle brackets (< and >), so type parameter names that match HTML markup tags need to use the character encodings < for < and > for >.
Type this To get this {{Javadoc:SE|class=Class<T>|java/lang|Class}}Class<T>{{Javadoc:SE|class=Class<T>|
member=asSubclass(Class<U>)|
java/lang|Class|asSubclass(java.lang.Class)}}Class<T>.asSubclass(Class<U>){{Javadoc:SE|package=java.lang|class=Class<T>|
java/lang|Class}}java.lang.Class<T>{{Javadoc:SE|package=java.lang|class=Class<T>|
member=asSubclass(Class<U>)|
java/lang|Class|asSubclass(java.lang.Class)}}java.lang.Class<T>.asSubclass(Class<U>)
The URL to a method uses the fully-qualified path name of the parameter types. The member parameter can be used to use the simple type name of method parameters, as shown in the preceding table, or even to eliminate the parameters entirely.
Finally, if none of the above work for the displayed text, supplying a name parameter allows the entire package/class/member name displayed to be replaced. (However, the name parameter won't override the text displayed when using the {{Javadoc:SE}} form.)
Type this To get this {{Javadoc:SE|name=out|java/lang|System|out}}out
Issues
Some versions of Javadoc, such as the version used to create the current Javadoc API pages, put spaces between the parameter names in the anchor tags used to link to the definitions of members. Unfortunately, that means to get a link to a method or constructor with two or more parameters to display correctly, the method/constructor signature needs both a displayed and link version like this:
Type this To get this {{Javadoc:SE|member=indexOf(int, int)|java/lang|String|indexOf(int,%20int)}}String.indexOf(int, int)
- Links in the current version do not contain spaces, the spaces are simply removed in the anchor tags.
Type this To get this {{Javadoc:SE|member=indexOf(int, int)|java/lang|String|indexOf(int,int)}}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, [ and ], like this:
Type this To get this {{Javadoc:SE|java/util|Arrays|sort(java.lang.Object[])}}Arrays.sort(java.lang.Object[]){{Javadoc:SE | member=sort(Object[])|java/util|Arrays|sort(java.lang.Object[])}}Arrays.sort(Object[])
See also