001/* 002 * Copyright (c) 2017, 2022, Oracle and/or its affiliates. All rights reserved. 003 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 004 * 005 * This code is free software; you can redistribute it and/or modify it 006 * under the terms of the GNU General Public License version 2 only, as 007 * published by the Free Software Foundation. Oracle designates this 008 * particular file as subject to the "Classpath" exception as provided 009 * by Oracle in the LICENSE file that accompanied this code. 010 * 011 * This code is distributed in the hope that it will be useful, but WITHOUT 012 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 013 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 014 * version 2 for more details (a copy is included in the LICENSE file that 015 * accompanied this code). 016 * 017 * You should have received a copy of the GNU General Public License version 018 * 2 along with this work; if not, write to the Free Software Foundation, 019 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 020 * 021 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 022 * or visit www.oracle.com if you need additional information or have any 023 * questions. 024 */ 025 026package org.jdrupes.mdoclet.internal.doclets.toolkit; 027 028import javax.lang.model.element.AnnotationMirror; 029import javax.lang.model.element.Element; 030import javax.lang.model.element.ElementKind; 031import javax.lang.model.element.ElementVisitor; 032import javax.lang.model.element.Modifier; 033import javax.lang.model.element.Name; 034import javax.lang.model.element.PackageElement; 035import javax.lang.model.type.TypeMirror; 036import javax.tools.FileObject; 037 038import java.lang.annotation.Annotation; 039import java.util.List; 040import java.util.Set; 041 042public interface DocletElement extends Element { 043 044 @Override 045 default TypeMirror asType() { 046 throw new UnsupportedOperationException("Unsupported method"); 047 } 048 049 @Override 050 default ElementKind getKind() { 051 return ElementKind.OTHER; 052 } 053 054 @Override 055 default Set<Modifier> getModifiers() { 056 throw new UnsupportedOperationException("Unsupported method"); 057 } 058 059 @Override 060 default Name getSimpleName() { 061 throw new UnsupportedOperationException("Unsupported method"); 062 } 063 064 @Override 065 default Element getEnclosingElement() { 066 throw new UnsupportedOperationException("Unsupported method"); 067 } 068 069 @Override 070 default List<? extends Element> getEnclosedElements() { 071 throw new UnsupportedOperationException("Unsupported method"); 072 } 073 074 @Override 075 default List<? extends AnnotationMirror> getAnnotationMirrors() { 076 throw new UnsupportedOperationException("Unsupported method"); 077 } 078 079 @Override 080 default <A extends Annotation> A getAnnotation(Class<A> annotationType) { 081 throw new UnsupportedOperationException("Unsupported method"); 082 } 083 084 @Override 085 default <R, P> R accept(ElementVisitor<R, P> v, P p) { 086 return v.visitUnknown(this, p); 087 } 088 089 @Override 090 default <A extends Annotation> A[] 091 getAnnotationsByType(Class<A> annotationType) { 092 throw new UnsupportedOperationException("Unsupported method"); 093 } 094 095 /** 096 * Returns the anchoring package element, in the case of a 097 * module element, this is the module's unnamed package. 098 * 099 * @return the anchor element. 100 */ 101 PackageElement getPackageElement(); 102 103 /** 104 * Returns the file object associated with this special 105 * element such as {@code overview.html}, {@code doc-files/foo.html}. 106 * @return the file object 107 */ 108 FileObject getFileObject(); 109 110 /** 111 * Returns the subkind of this element. 112 * @return a subkind 113 */ 114 Kind getSubKind(); 115 116 /** 117 * Subkind enums that this element supports. 118 */ 119 enum Kind { 120 OVERVIEW, DOCFILE; 121 } 122}