SeeTag.java revision 2571:10fc81ac75b4
1/* 2 * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. Oracle designates this 8 * particular file as subject to the "Classpath" exception as provided 9 * by Oracle in the LICENSE file that accompanied this code. 10 * 11 * This code is distributed in the hope that it will be useful, but WITHOUT 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 * version 2 for more details (a copy is included in the LICENSE file that 15 * accompanied this code). 16 * 17 * You should have received a copy of the GNU General Public License version 18 * 2 along with this work; if not, write to the Free Software Foundation, 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 * 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 * or visit www.oracle.com if you need additional information or have any 23 * questions. 24 */ 25 26package com.sun.javadoc; 27 28/** 29 * Represents a user-defined cross-reference to related documentation. 30 * The tag can reference a package, class or member, or can hold 31 * plain text. (The plain text might be a reference 32 * to something not online, such as a printed book, or be a hard-coded 33 * HTML link.) The reference can either be inline with the comment, 34 * using {@code {@link}}, or a separate block comment, 35 * using {@code @see}. 36 * Method {@code name()} returns "@link" (no curly braces) or 37 * "@see", depending on the tag. 38 * Method {@code kind()} returns "@see" for both tags. 39 * 40 * @author Kaiyang Liu (original) 41 * @author Robert Field (rewrite) 42 * @author Atul M Dambalkar 43 * 44 */ 45public interface SeeTag extends Tag { 46 47 /** 48 * Get the label of the {@code @see} tag. 49 * Return null if no label is present. 50 * For example, for: 51 * <p> 52 * {@code @see String#trim() the trim method} 53 * </p> 54 * return "the trim method". 55 * 56 * @return "the trim method". 57 */ 58 String label(); 59 60 /** 61 * Get the package doc when {@code @see} references only a package. 62 * Return null if the package cannot be found, or if 63 * {@code @see} references any other element (class, 64 * interface, field, constructor, method) or non-element. 65 * For example, for: 66 * <p> 67 * {@code @see java.lang} 68 * </p> 69 * return the {@code PackageDoc} for {@code java.lang}. 70 * 71 * @return the {@code PackageDoc} for {@code java.lang}. 72 */ 73 public PackageDoc referencedPackage(); 74 75 /** 76 * Get the class or interface name of the {@code @see} reference. 77 * The name is fully qualified if the name specified in the 78 * original {@code @see} tag was fully qualified, or if the class 79 * or interface can be found; otherwise it is unqualified. 80 * If {@code @see} references only a package name, then return 81 * the package name instead. 82 * For example, for: 83 * <p> 84 * {@code @see String#valueOf(java.lang.Object)} 85 * </p> 86 * return "java.lang.String". 87 * For "{@code @see java.lang}", return "java.lang". 88 * Return null if {@code @see} references a non-element, such as 89 * {@code @see <a href="java.sun.com">}. 90 * 91 * @return null if {@code @see} references a non-element, such as 92 * {@code @see <a href="java.sun.com">}. 93 */ 94 String referencedClassName(); 95 96 /** 97 * Get the class doc referenced by the class name part of @see. 98 * Return null if the class cannot be found. 99 * For example, for: 100 * <p> 101 * {@code @see String#valueOf(java.lang.Object)} 102 * </p> 103 * return the {@code ClassDoc} for {@code java.lang.String}. 104 * 105 * @return the {@code ClassDoc} for {@code java.lang.String}. 106 */ 107 ClassDoc referencedClass(); 108 109 /** 110 * Get the field, constructor or method substring of the {@code @see} 111 * reference. Return null if the reference is to any other 112 * element or to any non-element. 113 * References to member classes (nested classes) return null. 114 * For example, for: 115 * <p> 116 * {@code @see String#startsWith(String)} 117 * </p> 118 * return "startsWith(String)". 119 * 120 * @return "startsWith(String)". 121 */ 122 String referencedMemberName(); 123 124 /** 125 * Get the member doc for the field, constructor or method 126 * referenced by {@code @see}. Return null if the member cannot 127 * be found or if the reference is to any other element or to any 128 * non-element. 129 * References to member classes (nested classes) return null. 130 * For example, for: 131 * <p> 132 * {@code @see String#startsWith(java.lang.String)} 133 * </p> 134 * return the {@code MethodDoc} for {@code startsWith}. 135 * 136 * @return the {@code MethodDoc} for {@code startsWith}. 137 */ 138 MemberDoc referencedMember(); 139} 140