diff --git a/icu4j/tools/taglets/src/main/java/com/ibm/icu/dev/tool/docs/ICUDiscouragedTaglet.java b/icu4j/tools/taglets/src/main/java/com/ibm/icu/dev/tool/docs/ICUDiscouragedTaglet.java new file mode 100644 index 00000000000..83093eecce7 --- /dev/null +++ b/icu4j/tools/taglets/src/main/java/com/ibm/icu/dev/tool/docs/ICUDiscouragedTaglet.java @@ -0,0 +1,25 @@ +package com.ibm.icu.dev.tool.docs; + +import java.util.Map; + +import com.sun.javadoc.Tag; + +public class ICUDiscouragedTaglet extends ICUTaglet { + private static final String NAME = "discouraged"; + + public static void register(Map taglets) { + taglets.put(NAME, new ICUDiscouragedTaglet()); + } + + private ICUDiscouragedTaglet() { + super(NAME, MASK_DEFAULT); + } + + public String toString(Tag tag) { + String text = tag.text(); + if (text.length() == 0) { + System.err.println("Error: empty discouraged tag "); + } + return "
Following this tag (and period), ideally in the first paragraph, the '@icu' tag + * should be used with the text '_label_' to generate the standard boilerplate about + * how that tag is used in the class docs. See {@link ICUNewTaglet}. + * + *
This cumbersome process is necessary because the javadoc code that handles
+ * taglets doesn't look at punctuation in the substitution text to determine when to
+ * end the first line, it looks in the original javadoc comment. So we need a tag to
+ * identify the related java class, then a period, then another tag.
+ */
+ public class ICUEnhancedTaglet extends ICUTaglet {
+ private static final String NAME = "icuenhanced";
+
+ public static void register(Map taglets) {
+ taglets.put(NAME, new ICUEnhancedTaglet());
+ }
+
+ private ICUEnhancedTaglet() {
+ super(NAME, MASK_DEFAULT_INLINE);
+ }
+
+ public String toString(Tag tag) {
+ String text = tag.text().trim();
+
+ boolean isClassDoc = tag.holder().isClass() || tag.holder().isInterface();
+ if (isClassDoc && text.length() > 0) {
+ StringBuilder sb = new StringBuilder();
+ return sb.append("[icu enhancement] ")
+ .append("ICU's replacement for ")
+ .append(text)
+ .append("
")
+ .toString();
+ }
+ return "";
+ }
+}
\ No newline at end of file
diff --git a/icu4j/tools/taglets/src/main/java/com/ibm/icu/dev/tool/docs/ICUIgnoreTaglet.java b/icu4j/tools/taglets/src/main/java/com/ibm/icu/dev/tool/docs/ICUIgnoreTaglet.java
new file mode 100644
index 00000000000..f20b87efc4e
--- /dev/null
+++ b/icu4j/tools/taglets/src/main/java/com/ibm/icu/dev/tool/docs/ICUIgnoreTaglet.java
@@ -0,0 +1,26 @@
+package com.ibm.icu.dev.tool.docs;
+
+import java.util.Map;
+
+import com.sun.javadoc.Tag;
+
+public class ICUIgnoreTaglet extends ICUTaglet {
+ private static ICUTaglet singleton;
+
+ public static void register(Map taglets) {
+ if (singleton == null) {
+ singleton = new ICUIgnoreTaglet();
+ }
+ taglets.put("bug", singleton);
+ taglets.put("test", singleton);
+ taglets.put("summary", singleton);
+ }
+
+ private ICUIgnoreTaglet() {
+ super(".ignore", MASK_DEFAULT);
+ }
+
+ public String toString(Tag tag) {
+ return null;
+ }
+}
\ No newline at end of file
diff --git a/icu4j/tools/taglets/src/main/java/com/ibm/icu/dev/tool/docs/ICUInternalTaglet.java b/icu4j/tools/taglets/src/main/java/com/ibm/icu/dev/tool/docs/ICUInternalTaglet.java
new file mode 100644
index 00000000000..c69efa803ce
--- /dev/null
+++ b/icu4j/tools/taglets/src/main/java/com/ibm/icu/dev/tool/docs/ICUInternalTaglet.java
@@ -0,0 +1,27 @@
+package com.ibm.icu.dev.tool.docs;
+
+import java.util.Locale;
+import java.util.Map;
+
+import com.sun.javadoc.Tag;
+
+public class ICUInternalTaglet extends ICUTaglet {
+ private static final String NAME = "internal";
+
+ public static void register(Map taglets) {
+ taglets.put(NAME, new ICUInternalTaglet());
+ }
+
+ private ICUInternalTaglet() {
+ super(NAME, MASK_DEFAULT);
+ }
+
+ public String toString(Tag tag) {
+ if (tag.text().toLowerCase(Locale.US).indexOf("technology preview") >= 0) {
+ return STATUS + "
Note: if the text is '_usage_' (without quotes) this spits out a boilerplate + * message describing the meaning of the '[icu]' tag. This should be done in the + * first paragraph of the class docs of any class containing '@icu' tags. + */ +public class ICUNewTaglet extends ICUTaglet { + private static final String NAME = "icu"; + + public static void register(Map taglets) { + taglets.put(NAME, new ICUNewTaglet()); + } + + private ICUNewTaglet() { + super(NAME, MASK_DEFAULT_INLINE); + } + + public String toString(Tag tag) { + String text = tag.text().trim(); + StringBuilder sb = new StringBuilder(); + if ("_usage_".equals(text)) { + return sb.append(" Methods, fields, and other functionality specific to ICU ") + .append("are labeled '" + ICU_LABEL + "'.
") + .toString(); + } + + sb.append("[icu]"); + if (text.length() > 0) { + sb.append(" ").append(text); + } + sb.append(""); + return sb.toString(); + } +} \ No newline at end of file diff --git a/icu4j/tools/taglets/src/main/java/com/ibm/icu/dev/tool/docs/ICUNoteTaglet.java b/icu4j/tools/taglets/src/main/java/com/ibm/icu/dev/tool/docs/ICUNoteTaglet.java new file mode 100644 index 00000000000..507fc87b6c4 --- /dev/null +++ b/icu4j/tools/taglets/src/main/java/com/ibm/icu/dev/tool/docs/ICUNoteTaglet.java @@ -0,0 +1,26 @@ +package com.ibm.icu.dev.tool.docs; + +import java.util.Map; + +import com.sun.javadoc.Tag; + +/** + * This taglet should be used in class or member documentation, after the first line, + * where the behavior of the ICU method or class has notable differences from its JDK + * counterpart. It starts a new paragraph and generates an '[icu] Note:' header. + */ +public class ICUNoteTaglet extends ICUTaglet { + private static final String NAME = "icunote"; + + public static void register(Map taglets) { + taglets.put(NAME, new ICUNoteTaglet()); + } + + private ICUNoteTaglet() { + super(NAME, MASK_DEFAULT_INLINE); + } + + public String toString(Tag tag) { + return "[icu] Note: "; + } +} \ No newline at end of file diff --git a/icu4j/tools/taglets/src/main/java/com/ibm/icu/dev/tool/docs/ICUObsoleteTaglet.java b/icu4j/tools/taglets/src/main/java/com/ibm/icu/dev/tool/docs/ICUObsoleteTaglet.java new file mode 100644 index 00000000000..2fd791a5332 --- /dev/null +++ b/icu4j/tools/taglets/src/main/java/com/ibm/icu/dev/tool/docs/ICUObsoleteTaglet.java @@ -0,0 +1,33 @@ +package com.ibm.icu.dev.tool.docs; + +import java.text.BreakIterator; +import java.util.Locale; +import java.util.Map; + +import com.sun.javadoc.Tag; + +public class ICUObsoleteTaglet extends ICUTaglet { + private static final String NAME = "obsolete"; + + public static void register(Map taglets) { + taglets.put(NAME, new ICUObsoleteTaglet()); + } + + private ICUObsoleteTaglet() { + super(NAME, MASK_DEFAULT); + } + + public String toString(Tag tag) { + BreakIterator bi = BreakIterator.getSentenceInstance(Locale.US); + String text = tag.text(); + bi.setText(text); + int first = bi.first(); + int next = bi.next(); + if (text.length() == 0) { + first = next = 0; + } + return STATUS + "
Following this tag (and period), ideally in the first paragraph, the '@icu' tag - * should be used with the text '_label_' to generate the standard boilerplate about - * how that tag is used in the class docs. See {@link ICUNewTaglet}. - * - *
This cumbersome process is necessary because the javadoc code that handles
- * taglets doesn't look at punctuation in the substitution text to determine when to
- * end the first line, it looks in the original javadoc comment. So we need a tag to
- * identify the related java class, then a period, then another tag.
- */
- public static class ICUEnhancedTaglet extends ICUTaglet {
- private static final String NAME = "icuenhanced";
-
- public static void register(Map taglets) {
- taglets.put(NAME, new ICUEnhancedTaglet());
- }
-
- private ICUEnhancedTaglet() {
- super(NAME, MASK_DEFAULT_INLINE);
- }
-
- public String toString(Tag tag) {
- String text = tag.text().trim();
-
- boolean isClassDoc = tag.holder().isClass() || tag.holder().isInterface();
- if (isClassDoc && text.length() > 0) {
- StringBuilder sb = new StringBuilder();
- return sb.append("[icu enhancement] ")
- .append("ICU's replacement for ")
- .append(text)
- .append("
")
- .toString();
- }
- return "";
- }
- }
-
- /**
- * This taglet should be used in the first line of any icu-specific members in a class
- * that is an enhancement of a JDK class (see {@link ICUEnhancedTaglet}). It generates
- * the '[icu]' marker followed by the <strong> text, if any. This does not
- * start or end a paragraph or provide additional leading or trailing punctuation such
- * as spaces or periods.
- *
- *
Note: if the text is '_usage_' (without quotes) this spits out a boilerplate - * message describing the meaning of the '[icu]' tag. This should be done in the - * first paragraph of the class docs of any class containing '@icu' tags. - */ - public static class ICUNewTaglet extends ICUTaglet { - private static final String NAME = "icu"; - - public static void register(Map taglets) { - taglets.put(NAME, new ICUNewTaglet()); - } - - private ICUNewTaglet() { - super(NAME, MASK_DEFAULT_INLINE); - } - - public String toString(Tag tag) { - String text = tag.text().trim(); - StringBuilder sb = new StringBuilder(); - if ("_usage_".equals(text)) { - return sb.append(" Methods, fields, and other functionality specific to ICU ") - .append("are labeled '" + ICU_LABEL + "'.
") - .toString(); - } - - sb.append("[icu]"); - if (text.length() > 0) { - sb.append(" ").append(text); - } - sb.append(""); - return sb.toString(); - } - } - - /** - * This taglet should be used in class or member documentation, after the first line, - * where the behavior of the ICU method or class has notable differences from its JDK - * counterpart. It starts a new paragraph and generates an '[icu] Note:' header. - */ - public static class ICUNoteTaglet extends ICUTaglet { - private static final String NAME = "icunote"; - - public static void register(Map taglets) { - taglets.put(NAME, new ICUNoteTaglet()); - } - - private ICUNoteTaglet() { - super(NAME, MASK_DEFAULT_INLINE); - } - - public String toString(Tag tag) { - return "[icu] Note: "; - } - } + static String ICU_LABEL = "[icu]"; }