001package ball.tools.javadoc; 002/*- 003 * ########################################################################## 004 * Utilities 005 * $Id: LinkThisTaglet.java 6035 2020-05-25 03:01:46Z ball $ 006 * $HeadURL: svn+ssh://svn.hcf.dev/var/spool/scm/repository.svn/ball-util/trunk/src/main/java/ball/tools/javadoc/LinkThisTaglet.java $ 007 * %% 008 * Copyright (C) 2008 - 2020 Allen D. Ball 009 * %% 010 * Licensed under the Apache License, Version 2.0 (the "License"); 011 * you may not use this file except in compliance with the License. 012 * You may obtain a copy of the License at 013 * 014 * http://www.apache.org/licenses/LICENSE-2.0 015 * 016 * Unless required by applicable law or agreed to in writing, software 017 * distributed under the License is distributed on an "AS IS" BASIS, 018 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 019 * See the License for the specific language governing permissions and 020 * limitations under the License. 021 * ########################################################################## 022 */ 023import ball.annotation.ServiceProviderFor; 024import ball.xml.FluentNode; 025import com.sun.javadoc.Tag; 026import com.sun.tools.doclets.Taglet; 027import java.util.Map; 028import lombok.NoArgsConstructor; 029import lombok.ToString; 030 031import static org.apache.commons.lang3.StringUtils.isNotEmpty; 032 033/** 034 * Inline {@link Taglet} to provide {@link.this} links. 035 * 036 * @author {@link.uri mailto:ball@hcf.dev Allen D. Ball} 037 * @version $Revision: 6035 $ 038 */ 039@ServiceProviderFor({ Taglet.class }) 040@TagletName("link.this") 041@NoArgsConstructor @ToString 042public class LinkThisTaglet extends AbstractInlineTaglet 043 implements SunToolsInternalToolkitTaglet { 044 private static final LinkThisTaglet INSTANCE = new LinkThisTaglet(); 045 046 public static void register(Map<Object,Object> map) { 047 register(map, INSTANCE); 048 } 049 050 @Override 051 public FluentNode toNode(Tag tag) throws Throwable { 052 if (isNotEmpty(tag.text().trim())) { 053 throw new IllegalArgumentException("Invalid argument"); 054 } 055 056 return a(tag, getClassFor(containingClass(tag)), "this"); 057 } 058}