001/*
002 * Copyright (c) 2009 The openGion Project.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *     http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
013 * either express or implied. See the License for the specific language
014 * governing permissions and limitations under the License.
015 */
016package org.opengion.fukurou.taglet;
017
018import com.sun.tools.doclets.standard.Standard;
019
020import com.sun.javadoc.RootDoc;
021import com.sun.javadoc.ClassDoc;
022
023/**
024 * ソースコメントから、タグ情報を取り出す Doclet クラスです。
025 * クラスファイルの仕様を表現する為、og.formSample , og.rev , og.group ,
026 * version , author , since の各タグコメントより値を抽出します。
027 * また、各クラスの継承関係、インターフェース、メソッドなども抽出します。
028 * これらの抽出結果をDB化し、EXCELファイルに帳票出力する事で、クラスファイルの
029 * ソースから仕様書を逆作成します。
030 *
031 * @version  4.0
032 * @author   Kazuhiko Hasegawa
033 * @since    JDK5.0,
034 */
035public final class DocletStandard {
036
037        /**
038         * Doclet のエントリポイントメソッドです。
039         *
040         * @og.rev 5.5.4.1 (2012/07/06) Tag出力時の CR → BR 変換を行わない様にする。
041         * @og.rev 5.7.1.1 (2013/12/13) タグのインデントを止める。
042         *
043         * @param       root    エントリポイントのRootDocオブジェクト
044         *
045         * @return 正常実行時 true
046         */
047        public static boolean start( final RootDoc root ) {
048                for ( ClassDoc classdoc : root.classes() ) {
049                        classdoc.setRawCommentText( "<pre>" + classdoc.getRawCommentText() + "</pre>" );
050                }
051
052                return Standard.start( root ); 
053        }
054
055        /**
056         * カスタムオプションを使用するドックレットの必須メソッド optionLength(String) です。
057         *
058         * ドックレットに認識させる各カスタムオプションに、 optionLength がその
059         * オプションを構成する要素 (トークン) の数を返さなければなりません。
060         * このカスタムオプションでは、 -tag オプションそのものと
061         * その値の 2 つの要素で構成されるので、作成するドックレットの
062         * optionLengthメソッドは、 -tag オプションに対して 2 を返さなくては
063         * なりません。また、認識できないオプションに対しては、0 を返します。
064         *
065         * @param       option  オプション文字列
066         *
067         * @return      要素(トークン) の数
068         */
069//      public static int optionLength( final String option ) {
070//              return Standard.optionLength(option);
071//      }
072}