You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

DocImpl.java 7.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280
  1. /* -*- Mode: JDE; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
  2. *
  3. * This file is part of the debugger and core tools for the AspectJ(tm)
  4. * programming language; see http://aspectj.org
  5. *
  6. * The contents of this file are subject to the Mozilla Public License
  7. * Version 1.1 (the "License"); you may not use this file except in
  8. * compliance with the License. You may obtain a copy of the License at
  9. * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
  10. *
  11. * Software distributed under the License is distributed on an "AS IS" basis,
  12. * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  13. * for the specific language governing rights and limitations under the
  14. * License.
  15. *
  16. * The Original Code is AspectJ.
  17. *
  18. * The Initial Developer of the Original Code is Xerox Corporation. Portions
  19. * created by Xerox Corporation are Copyright (C) 1999-2002 Xerox Corporation.
  20. * All Rights Reserved.
  21. */
  22. package org.aspectj.tools.ajdoc;
  23. import org.aspectj.ajdoc.Doc;
  24. import com.sun.javadoc.SeeTag;
  25. import com.sun.javadoc.Tag;
  26. import java.util.Locale;
  27. public abstract class DocImpl
  28. implements org.aspectj.ajdoc.Doc {
  29. /** Keep track of whether this is included or not. */
  30. private boolean isIncluded = true;
  31. /** The comment for this Doc. */
  32. private Comment comment;
  33. /** The error printer for this Doc. */
  34. private ErrPrinter err;
  35. /** Keep track of whether this is included or not. */
  36. private boolean isInterface = true;
  37. /** The locale of the object -- default to <code>Locale.US</code>. */
  38. private Locale locale = Locale.US; //TODO
  39. /**
  40. * Returns the locale.
  41. *
  42. * @return the locale.
  43. */
  44. public Locale locale() { //XXX
  45. return locale;
  46. }
  47. public void setErr(ErrPrinter err) { this.err = err; }
  48. public ErrPrinter err() { return ErrPrinter.instance; }
  49. public void setComment(Comment comment) { this.comment = comment; }
  50. public Comment getComment() { return comment; }
  51. /**
  52. * Delegates to {@link Util#compareTo(Object)} to compare
  53. * with another Object.
  54. *
  55. * @return a negative integer, zero, or a positive integer
  56. * as this object is less than, equal to, or greater
  57. * than the specified object based on name.
  58. * @see java.lang.Comparable.compareTo(Object)
  59. */
  60. public int compareTo(Object other) {
  61. return other instanceof Doc
  62. ? Util.compareTo(this, (Doc)other)
  63. : -1;
  64. }
  65. /**
  66. * Returns the Tags that comprise the first
  67. * sentence of the comment.
  68. *
  69. * @return an array of Tag representing the first
  70. * sentence of the comment.
  71. */
  72. public Tag[] firstSentenceTags() {
  73. return getComment() != null
  74. ? getComment().firstSentenceTags()
  75. : new Tag[0];
  76. }
  77. /**
  78. * Returns the full unprocessed text of the comment.
  79. *
  80. * @return the full unprocessed text of the comment.
  81. */
  82. public String getRawCommentText() {
  83. return getComment() != null
  84. ? getComment().rawCommentText()
  85. : "";
  86. }
  87. /**
  88. * Sets the full unprocessed text of the comment.
  89. *
  90. * @param rawCommentText the new full unprocessed text of the comment..
  91. */
  92. public void setRawCommentText(String rawCommentText) {
  93. if (getComment() != null) {
  94. getComment().setRawCommentText(rawCommentText);
  95. }
  96. }
  97. /**
  98. * Returns the comment as an array of Tag.
  99. *
  100. * @return an array of Tag representing the comment.
  101. */
  102. public Tag[] inlineTags() {
  103. return getComment() != null
  104. ? getComment().inlineTags()
  105. : new Tag[0];
  106. }
  107. /**
  108. * Returns the see tags of the comment.
  109. *
  110. * @return an array of SeeTag representing the
  111. * see tags of the comment.
  112. */
  113. public SeeTag[] seeTags() {
  114. return getComment() != null
  115. ? getComment().seeTags()
  116. : new SeeTag[0];
  117. }
  118. /**
  119. * Returns all tags of the comment.
  120. *
  121. * @return an array of Tag representing all
  122. * tags of the comment.
  123. */
  124. public Tag[] tags() {
  125. return getComment() != null
  126. ? getComment().tags()
  127. : new Tag[0];
  128. }
  129. /**
  130. * Returns all tags of the comment whose name equals
  131. * <code>tagname</code>.
  132. *
  133. * @return an array of Tag representing all tags of the
  134. * comment whose name equals <code>tagname</code>.
  135. */
  136. public Tag[] tags(String tagname) {
  137. return getComment() != null
  138. ? getComment().tags(tagname)
  139. : new Tag[0];
  140. }
  141. /**
  142. * Returns the commext text for non-null comments,
  143. * otherwise the empty String.
  144. *
  145. * @return non-null comment text.
  146. */
  147. public String commentText() {
  148. return getComment() != null
  149. ? getComment().commentText()
  150. : "";
  151. }
  152. /**
  153. * Sets <code>isIncluded</code>.
  154. *
  155. * @param isIncluded the new value of <code>isIncluded</code>.
  156. */
  157. public void setIncluded(boolean isIncluded) {
  158. this.isIncluded = isIncluded;
  159. }
  160. /**
  161. * Returns <code>false</code> by default.
  162. *
  163. * @return <code>false</code> by default.
  164. */
  165. public boolean isClass() {
  166. return false;
  167. }
  168. /**
  169. * Returns <code>false</code> by default.
  170. *
  171. * @return <code>false</code> by default.
  172. */
  173. public boolean isConstructor() {
  174. return false;
  175. }
  176. /**
  177. * Returns <code>false</code> by default.
  178. *
  179. * @return <code>false</code> by default.
  180. */
  181. public boolean isError() {
  182. return false;
  183. }
  184. /**
  185. * Returns <code>false</code> by default.
  186. *
  187. * @return <code>false</code> by default.
  188. */
  189. public boolean isException() {
  190. return false;
  191. }
  192. /**
  193. * Returns <code>false</code> by default.
  194. *
  195. * @return <codealse</code> by default./
  196. */
  197. public boolean isField() {
  198. return false;
  199. }
  200. /**
  201. * Returns <code>isIncluded</code> by default.
  202. *
  203. * @return <codesIncluded</code> by default./
  204. */
  205. public boolean isIncluded() {
  206. return isIncluded;
  207. }
  208. /**
  209. * Returns <code>false</code> by default.
  210. *
  211. * @return <codealse</code> by default./
  212. */
  213. public boolean isInterface() {
  214. return false;
  215. }
  216. /**
  217. * Returns <code>false</code> by default.
  218. *
  219. * @return <codealse</code> by default./
  220. */
  221. public boolean isMethod() {
  222. return false;
  223. }
  224. /**
  225. * Returns <code>false</code> by default.
  226. *
  227. * @return <codealse</code> by default./
  228. */
  229. public boolean isOrdinaryClass() {
  230. return false;
  231. }
  232. /**
  233. * Returns <code>false</code> by default.
  234. *
  235. * @return <codealse</code> by default./
  236. */
  237. public boolean isPointcut() {
  238. return false;
  239. }
  240. /**
  241. * Returns <code>false</code> by default.
  242. *
  243. * @return <codealse</code> by default./
  244. */
  245. public boolean isAdvice() {
  246. return false;
  247. }
  248. }