Path: blob/master/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/DocEnvImpl.java
41161 views
/*1* Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425package jdk.javadoc.internal.tool;2627import java.util.Set;2829import javax.lang.model.SourceVersion;30import javax.lang.model.element.Element;31import javax.lang.model.element.TypeElement;32import javax.lang.model.util.Elements;33import javax.lang.model.util.Types;34import javax.tools.JavaFileManager;35import javax.tools.JavaFileObject.Kind;3637import com.sun.source.util.DocTrees;38import com.sun.tools.javac.code.Source;39import jdk.javadoc.doclet.DocletEnvironment;4041/**42* This class holds the information from one run of javadoc.43* Particularly the packages, classes and options specified44* by the user.45*46* <p><b>This is NOT part of any supported API.47* If you write code that depends on this, you do so at your own risk.48* This code and its internal interfaces are subject to change or49* deletion without notice.</b>50*/51public class DocEnvImpl implements DocletEnvironment {5253public final ElementsTable etable;5455public final ToolEnvironment toolEnv;5657/**58* Construct a doclet environment.59*60* @param toolEnv the tool environment61* @param etable the includes table, providing all the information62* with respect to specified, included/selected elements.63*/64public DocEnvImpl(ToolEnvironment toolEnv, ElementsTable etable) {65this.toolEnv = toolEnv;66this.etable = etable;67}68@Override69public Set<? extends Element> getSpecifiedElements() {70return etable.getSpecifiedElements();71}7273@Override74public Set<? extends Element> getIncludedElements() {75return etable.getIncludedElements();76}7778@Override79public boolean isIncluded(Element e) {80return etable.isIncluded(e);81}8283@Override84public DocTrees getDocTrees() {85return toolEnv.docTrees;86}8788@Override89public Elements getElementUtils() {90return toolEnv.elements;91}9293@Override94public Types getTypeUtils() {95return toolEnv.typeutils;96}9798@Override99public JavaFileManager getJavaFileManager() {100return toolEnv.fileManager;101}102103@Override104public SourceVersion getSourceVersion() {105return Source.toSourceVersion(toolEnv.source);106}107108@Override109public ModuleMode getModuleMode() {110return etable.getModuleMode();111}112113@Override114public Kind getFileKind(TypeElement type) {115return toolEnv.getFileKind(type);116}117118@Override119public boolean isSelected(Element e) {120return etable.isSelected(e);121}122}123124125