1// © 2016 and later: Unicode, Inc. and others. 2// License & terms of use: http://www.unicode.org/copyright.html#License 3/* 4 ******************************************************************************* 5 * Copyright (C) 2015, International Business Machines Corporation and * 6 * others. All Rights Reserved. * 7 ******************************************************************************* 8 */ 9package com.ibm.icu.dev.tool.docs; 10 11import com.sun.javadoc.Doc; 12import com.sun.javadoc.Tag; 13import com.sun.tools.doclets.internal.toolkit.taglets.Taglet; 14import com.sun.tools.doclets.internal.toolkit.taglets.TagletOutput; 15import com.sun.tools.doclets.internal.toolkit.taglets.TagletWriter; 16 17/** 18 * The ICUTagletAdapter class is the abstract base class that adapts the ICUTaglet class to different implementations of the JavaDoc API. 19 * The methods in this class are meant to minimize the dual maintenance nature of supporting multiple JavaDoc APIs. 20 * 21 * This adapter supports the v7 and earlier JavaDoc API 22 */ 23public abstract class ICUTagletAdapter implements Taglet { 24 25 public abstract String toString(Tag tag); 26 27 public abstract String toString(Tag[] tags); 28 29 public TagletOutput getTagletOutput(Tag tag, TagletWriter writer) 30 throws IllegalArgumentException { 31 32 TagletOutput out = writer.getTagletOutputInstance(); 33 out.setOutput(toString(tag)); 34 return out; 35 } 36 37 public TagletOutput getTagletOutput(Doc holder, TagletWriter writer) 38 throws IllegalArgumentException { 39 40 TagletOutput out = writer.getTagletOutputInstance(); 41 Tag[] tags = holder.tags(getName()); 42 if (tags.length == 0) { 43 return null; 44 } 45 out.setOutput(toString(tags[0])); 46 return out; 47 } 48 49} 50