|
Java example source code file (DocTreeMaker.java)
The DocTreeMaker.java Java example source code/* * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package com.sun.tools.javac.tree; import com.sun.source.doctree.AttributeTree.ValueKind; import com.sun.source.doctree.DocTree.Kind; import com.sun.tools.javac.parser.Tokens.Comment; import com.sun.tools.javac.tree.DCTree.*; import com.sun.tools.javac.util.Context; import com.sun.tools.javac.util.DiagnosticSource; import com.sun.tools.javac.util.JCDiagnostic; import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition; import com.sun.tools.javac.util.List; import com.sun.tools.javac.util.Name; import com.sun.tools.javac.util.Position; /** * * <p>This is NOT part of any supported API. * If you write code that depends on this, you do so at your own risk. * This code and its internal interfaces are subject to change or * deletion without notice.</b> */ public class DocTreeMaker { /** The context key for the tree factory. */ protected static final Context.Key<DocTreeMaker> treeMakerKey = new Context.Key<DocTreeMaker>(); /** Get the TreeMaker instance. */ public static DocTreeMaker instance(Context context) { DocTreeMaker instance = context.get(treeMakerKey); if (instance == null) instance = new DocTreeMaker(context); return instance; } /** The position at which subsequent trees will be created. */ public int pos = Position.NOPOS; /** Access to diag factory for ErroneousTrees. */ private final JCDiagnostic.Factory diags; /** Create a tree maker with NOPOS as initial position. */ protected DocTreeMaker(Context context) { context.put(treeMakerKey, this); diags = JCDiagnostic.Factory.instance(context); this.pos = Position.NOPOS; } /** Reassign current position. */ public DocTreeMaker at(int pos) { this.pos = pos; return this; } /** Reassign current position. */ public DocTreeMaker at(DiagnosticPosition pos) { this.pos = (pos == null ? Position.NOPOS : pos.getStartPosition()); return this; } public DCAttribute Attribute(Name name, ValueKind vkind, List<DCTree> value) { DCAttribute tree = new DCAttribute(name, vkind, value); tree.pos = pos; return tree; } public DCAuthor Author(List<DCTree> name) { DCAuthor tree = new DCAuthor(name); tree.pos = pos; return tree; } public DCLiteral Code(DCText text) { DCLiteral tree = new DCLiteral(Kind.CODE, text); tree.pos = pos; return tree; } public DCComment Comment(String text) { DCComment tree = new DCComment(text); tree.pos = pos; return tree; } public DCDeprecated Deprecated(List<DCTree> text) { DCDeprecated tree = new DCDeprecated(text); tree.pos = pos; return tree; } public DCDocComment DocComment(Comment comment, List<DCTree> firstSentence, List Other Java examples (source code examples)Here is a short list of links related to this Java DocTreeMaker.java source code file: |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2024 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.