langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/SerialFieldTagImpl.java
author jjg
Fri, 27 May 2016 13:06:58 -0700
changeset 38617 d93a7f64e231
parent 37938 42baa89d2156
permissions -rw-r--r--
8157606: deprecate com.sun.javadoc API Reviewed-by: ksrini
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     1
/*
14260
727a84636f12 8000665: fix "internal API" comments on javadoc files
jjg
parents: 10190
diff changeset
     2
 * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
06bc494ca11e Initial load
duke
parents:
diff changeset
     4
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
06bc494ca11e Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5520
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 10
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5520
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 10
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    10
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
06bc494ca11e Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
06bc494ca11e Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
06bc494ca11e Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
06bc494ca11e Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
06bc494ca11e Initial load
duke
parents:
diff changeset
    16
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
06bc494ca11e Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
06bc494ca11e Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
06bc494ca11e Initial load
duke
parents:
diff changeset
    20
 *
5520
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 10
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 10
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 10
diff changeset
    23
 * questions.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    24
 */
06bc494ca11e Initial load
duke
parents:
diff changeset
    25
37938
42baa89d2156 8075703: jdk.javadoc module exports com.sun.tools.javadoc package which contains a lot of internal API.
jjg
parents: 25874
diff changeset
    26
package com.sun.tools.javadoc.main;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    27
06bc494ca11e Initial load
duke
parents:
diff changeset
    28
import com.sun.javadoc.*;
06bc494ca11e Initial load
duke
parents:
diff changeset
    29
06bc494ca11e Initial load
duke
parents:
diff changeset
    30
/**
06bc494ca11e Initial load
duke
parents:
diff changeset
    31
 * Documents a Serializable field defined by an ObjectStreamField.
06bc494ca11e Initial load
duke
parents:
diff changeset
    32
 * <pre>
06bc494ca11e Initial load
duke
parents:
diff changeset
    33
 * The class parses and stores the three serialField tag parameters:
06bc494ca11e Initial load
duke
parents:
diff changeset
    34
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
    35
 * - field name
06bc494ca11e Initial load
duke
parents:
diff changeset
    36
 * - field type name
06bc494ca11e Initial load
duke
parents:
diff changeset
    37
 *      (fully-qualified or visible from the current import context)
06bc494ca11e Initial load
duke
parents:
diff changeset
    38
 * - description of the valid values for the field
06bc494ca11e Initial load
duke
parents:
diff changeset
    39
06bc494ca11e Initial load
duke
parents:
diff changeset
    40
 * </pre>
06bc494ca11e Initial load
duke
parents:
diff changeset
    41
 * This tag is only allowed in the javadoc for the special member
06bc494ca11e Initial load
duke
parents:
diff changeset
    42
 * serialPersistentFields.
06bc494ca11e Initial load
duke
parents:
diff changeset
    43
 *
14260
727a84636f12 8000665: fix "internal API" comments on javadoc files
jjg
parents: 10190
diff changeset
    44
 *  <p><b>This is NOT part of any supported API.
727a84636f12 8000665: fix "internal API" comments on javadoc files
jjg
parents: 10190
diff changeset
    45
 *  If you write code that depends on this, you do so at your own risk.
727a84636f12 8000665: fix "internal API" comments on javadoc files
jjg
parents: 10190
diff changeset
    46
 *  This code and its internal interfaces are subject to change or
727a84636f12 8000665: fix "internal API" comments on javadoc files
jjg
parents: 10190
diff changeset
    47
 *  deletion without notice.</b>
727a84636f12 8000665: fix "internal API" comments on javadoc files
jjg
parents: 10190
diff changeset
    48
 *
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    49
 * @author Joe Fialli
06bc494ca11e Initial load
duke
parents:
diff changeset
    50
 * @author Neal Gafter
06bc494ca11e Initial load
duke
parents:
diff changeset
    51
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
    52
 * @see java.io.ObjectStreamField
06bc494ca11e Initial load
duke
parents:
diff changeset
    53
 */
38617
d93a7f64e231 8157606: deprecate com.sun.javadoc API
jjg
parents: 37938
diff changeset
    54
@Deprecated
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    55
class SerialFieldTagImpl
06bc494ca11e Initial load
duke
parents:
diff changeset
    56
    extends TagImpl
06bc494ca11e Initial load
duke
parents:
diff changeset
    57
    implements SerialFieldTag, Comparable<Object>
06bc494ca11e Initial load
duke
parents:
diff changeset
    58
{
06bc494ca11e Initial load
duke
parents:
diff changeset
    59
    //### These could be final, except that the constructor
06bc494ca11e Initial load
duke
parents:
diff changeset
    60
    //### does not set them directly.
06bc494ca11e Initial load
duke
parents:
diff changeset
    61
06bc494ca11e Initial load
duke
parents:
diff changeset
    62
    private String fieldName;    // Required Argument 1 of serialField
06bc494ca11e Initial load
duke
parents:
diff changeset
    63
    private String fieldType;    // Required Argument 2 of serialField
06bc494ca11e Initial load
duke
parents:
diff changeset
    64
    private String description;  // Optional Remaining Arguments of serialField
06bc494ca11e Initial load
duke
parents:
diff changeset
    65
06bc494ca11e Initial load
duke
parents:
diff changeset
    66
    private ClassDoc containingClass;   // Class containing serialPersistentField member
06bc494ca11e Initial load
duke
parents:
diff changeset
    67
    private ClassDoc fieldTypeDoc;      // ClassDocImpl of fieldType
06bc494ca11e Initial load
duke
parents:
diff changeset
    68
    private FieldDocImpl matchingField; // FieldDocImpl with same name as fieldName
06bc494ca11e Initial load
duke
parents:
diff changeset
    69
06bc494ca11e Initial load
duke
parents:
diff changeset
    70
   /* Constructor. */
06bc494ca11e Initial load
duke
parents:
diff changeset
    71
   SerialFieldTagImpl(DocImpl holder, String name, String text) {
06bc494ca11e Initial load
duke
parents:
diff changeset
    72
        super(holder, name, text);
06bc494ca11e Initial load
duke
parents:
diff changeset
    73
        parseSerialFieldString();
06bc494ca11e Initial load
duke
parents:
diff changeset
    74
        if (holder instanceof MemberDoc) {
06bc494ca11e Initial load
duke
parents:
diff changeset
    75
            containingClass = ((MemberDocImpl)holder).containingClass();
06bc494ca11e Initial load
duke
parents:
diff changeset
    76
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
    77
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
    78
06bc494ca11e Initial load
duke
parents:
diff changeset
    79
    /*
06bc494ca11e Initial load
duke
parents:
diff changeset
    80
     * The serialField tag is composed of three entities.
06bc494ca11e Initial load
duke
parents:
diff changeset
    81
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
    82
     *   serialField  serializableFieldName serisliableFieldType
06bc494ca11e Initial load
duke
parents:
diff changeset
    83
     *                 description of field.
06bc494ca11e Initial load
duke
parents:
diff changeset
    84
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
    85
     * The fieldName and fieldType must be legal Java Identifiers.
06bc494ca11e Initial load
duke
parents:
diff changeset
    86
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
    87
    private void parseSerialFieldString() {
06bc494ca11e Initial load
duke
parents:
diff changeset
    88
        int len = text.length();
10190
11c701650189 6735320: StringIndexOutOfBoundsException for empty @serialField tag
ksrini
parents: 5520
diff changeset
    89
        if (len == 0) {
11c701650189 6735320: StringIndexOutOfBoundsException for empty @serialField tag
ksrini
parents: 5520
diff changeset
    90
            return;
11c701650189 6735320: StringIndexOutOfBoundsException for empty @serialField tag
ksrini
parents: 5520
diff changeset
    91
        }
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    92
06bc494ca11e Initial load
duke
parents:
diff changeset
    93
        // if no white space found
06bc494ca11e Initial load
duke
parents:
diff changeset
    94
        /* Skip white space. */
06bc494ca11e Initial load
duke
parents:
diff changeset
    95
        int inx = 0;
06bc494ca11e Initial load
duke
parents:
diff changeset
    96
        int cp;
06bc494ca11e Initial load
duke
parents:
diff changeset
    97
        for (; inx < len; inx += Character.charCount(cp)) {
06bc494ca11e Initial load
duke
parents:
diff changeset
    98
             cp = text.codePointAt(inx);
06bc494ca11e Initial load
duke
parents:
diff changeset
    99
             if (!Character.isWhitespace(cp)) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   100
                 break;
06bc494ca11e Initial load
duke
parents:
diff changeset
   101
             }
06bc494ca11e Initial load
duke
parents:
diff changeset
   102
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   103
06bc494ca11e Initial load
duke
parents:
diff changeset
   104
        /* find first word. */
06bc494ca11e Initial load
duke
parents:
diff changeset
   105
        int first = inx;
06bc494ca11e Initial load
duke
parents:
diff changeset
   106
        int last = inx;
06bc494ca11e Initial load
duke
parents:
diff changeset
   107
        cp = text.codePointAt(inx);
06bc494ca11e Initial load
duke
parents:
diff changeset
   108
        if (! Character.isJavaIdentifierStart(cp)) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   109
            docenv().warning(holder,
06bc494ca11e Initial load
duke
parents:
diff changeset
   110
                             "tag.serialField.illegal_character",
06bc494ca11e Initial load
duke
parents:
diff changeset
   111
                             new String(Character.toChars(cp)), text);
06bc494ca11e Initial load
duke
parents:
diff changeset
   112
            return;
06bc494ca11e Initial load
duke
parents:
diff changeset
   113
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   114
06bc494ca11e Initial load
duke
parents:
diff changeset
   115
        for (inx += Character.charCount(cp); inx < len; inx += Character.charCount(cp)) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   116
             cp = text.codePointAt(inx);
06bc494ca11e Initial load
duke
parents:
diff changeset
   117
             if (!Character.isJavaIdentifierPart(cp)) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   118
                 break;
06bc494ca11e Initial load
duke
parents:
diff changeset
   119
             }
06bc494ca11e Initial load
duke
parents:
diff changeset
   120
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   121
06bc494ca11e Initial load
duke
parents:
diff changeset
   122
        if (inx < len && ! Character.isWhitespace(cp = text.codePointAt(inx))) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   123
            docenv().warning(holder,
06bc494ca11e Initial load
duke
parents:
diff changeset
   124
                             "tag.serialField.illegal_character",
06bc494ca11e Initial load
duke
parents:
diff changeset
   125
                             new String(Character.toChars(cp)), text);
06bc494ca11e Initial load
duke
parents:
diff changeset
   126
            return;
06bc494ca11e Initial load
duke
parents:
diff changeset
   127
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   128
06bc494ca11e Initial load
duke
parents:
diff changeset
   129
        last = inx;
06bc494ca11e Initial load
duke
parents:
diff changeset
   130
        fieldName = text.substring(first, last);
06bc494ca11e Initial load
duke
parents:
diff changeset
   131
06bc494ca11e Initial load
duke
parents:
diff changeset
   132
        /* Skip white space. */
06bc494ca11e Initial load
duke
parents:
diff changeset
   133
        for (; inx < len; inx += Character.charCount(cp)) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   134
             cp = text.codePointAt(inx);
06bc494ca11e Initial load
duke
parents:
diff changeset
   135
             if (!Character.isWhitespace(cp)) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   136
                 break;
06bc494ca11e Initial load
duke
parents:
diff changeset
   137
             }
06bc494ca11e Initial load
duke
parents:
diff changeset
   138
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   139
06bc494ca11e Initial load
duke
parents:
diff changeset
   140
        /* find second word. */
06bc494ca11e Initial load
duke
parents:
diff changeset
   141
        first = inx;
06bc494ca11e Initial load
duke
parents:
diff changeset
   142
        last = inx;
06bc494ca11e Initial load
duke
parents:
diff changeset
   143
06bc494ca11e Initial load
duke
parents:
diff changeset
   144
        for (; inx < len; inx += Character.charCount(cp)) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   145
             cp = text.codePointAt(inx);
06bc494ca11e Initial load
duke
parents:
diff changeset
   146
             if (Character.isWhitespace(cp)) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   147
                 break;
06bc494ca11e Initial load
duke
parents:
diff changeset
   148
             }
06bc494ca11e Initial load
duke
parents:
diff changeset
   149
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   150
        if (inx < len && ! Character.isWhitespace(cp = text.codePointAt(inx))) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   151
            docenv().warning(holder,
06bc494ca11e Initial load
duke
parents:
diff changeset
   152
                             "tag.serialField.illegal_character",
06bc494ca11e Initial load
duke
parents:
diff changeset
   153
                             new String(Character.toChars(cp)), text);
06bc494ca11e Initial load
duke
parents:
diff changeset
   154
            return;
06bc494ca11e Initial load
duke
parents:
diff changeset
   155
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   156
        last = inx;
06bc494ca11e Initial load
duke
parents:
diff changeset
   157
        fieldType = text.substring(first, last);
06bc494ca11e Initial load
duke
parents:
diff changeset
   158
06bc494ca11e Initial load
duke
parents:
diff changeset
   159
        /* Skip leading white space. Rest of string is description for serialField.*/
06bc494ca11e Initial load
duke
parents:
diff changeset
   160
        for (; inx < len; inx += Character.charCount(cp)) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   161
             cp = text.codePointAt(inx);
06bc494ca11e Initial load
duke
parents:
diff changeset
   162
             if (!Character.isWhitespace(cp)) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   163
                 break;
06bc494ca11e Initial load
duke
parents:
diff changeset
   164
             }
06bc494ca11e Initial load
duke
parents:
diff changeset
   165
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   166
        description = text.substring(inx);
06bc494ca11e Initial load
duke
parents:
diff changeset
   167
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   168
06bc494ca11e Initial load
duke
parents:
diff changeset
   169
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   170
     * return a key for sorting.
06bc494ca11e Initial load
duke
parents:
diff changeset
   171
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   172
    String key() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   173
        return fieldName;
06bc494ca11e Initial load
duke
parents:
diff changeset
   174
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   175
06bc494ca11e Initial load
duke
parents:
diff changeset
   176
    /*
06bc494ca11e Initial load
duke
parents:
diff changeset
   177
     * Optional. Link this serialField tag to its corrsponding
06bc494ca11e Initial load
duke
parents:
diff changeset
   178
     * field in the class. Note: there is no requirement that
06bc494ca11e Initial load
duke
parents:
diff changeset
   179
     * there be a field in the class that matches serialField tag.
06bc494ca11e Initial load
duke
parents:
diff changeset
   180
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   181
    void mapToFieldDocImpl(FieldDocImpl fd) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   182
        matchingField = fd;
06bc494ca11e Initial load
duke
parents:
diff changeset
   183
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   184
06bc494ca11e Initial load
duke
parents:
diff changeset
   185
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   186
     * Return the serialziable field name.
06bc494ca11e Initial load
duke
parents:
diff changeset
   187
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   188
    public String fieldName() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   189
        return fieldName;
06bc494ca11e Initial load
duke
parents:
diff changeset
   190
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   191
06bc494ca11e Initial load
duke
parents:
diff changeset
   192
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   193
     * Return the field type string.
06bc494ca11e Initial load
duke
parents:
diff changeset
   194
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   195
    public String fieldType() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   196
        return fieldType;
06bc494ca11e Initial load
duke
parents:
diff changeset
   197
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   198
06bc494ca11e Initial load
duke
parents:
diff changeset
   199
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   200
     * Return the ClassDocImpl for field type.
06bc494ca11e Initial load
duke
parents:
diff changeset
   201
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   202
     * @returns null if no ClassDocImpl for field type is visible from
06bc494ca11e Initial load
duke
parents:
diff changeset
   203
     *          containingClass context.
06bc494ca11e Initial load
duke
parents:
diff changeset
   204
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   205
    public ClassDoc fieldTypeDoc() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   206
        if (fieldTypeDoc == null && containingClass != null) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   207
            fieldTypeDoc = containingClass.findClass(fieldType);
06bc494ca11e Initial load
duke
parents:
diff changeset
   208
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   209
        return fieldTypeDoc;
06bc494ca11e Initial load
duke
parents:
diff changeset
   210
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   211
06bc494ca11e Initial load
duke
parents:
diff changeset
   212
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   213
     * Return the corresponding FieldDocImpl for this SerialFieldTagImpl.
06bc494ca11e Initial load
duke
parents:
diff changeset
   214
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   215
     * @returns null if no matching FieldDocImpl.
06bc494ca11e Initial load
duke
parents:
diff changeset
   216
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   217
    FieldDocImpl getMatchingField() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   218
        return matchingField;
06bc494ca11e Initial load
duke
parents:
diff changeset
   219
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   220
06bc494ca11e Initial load
duke
parents:
diff changeset
   221
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   222
     * Return the field comment. If there is no serialField comment, return
06bc494ca11e Initial load
duke
parents:
diff changeset
   223
     * javadoc comment of corresponding FieldDocImpl.
06bc494ca11e Initial load
duke
parents:
diff changeset
   224
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   225
    public String description() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   226
        if (description.length() == 0 && matchingField != null) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   227
06bc494ca11e Initial load
duke
parents:
diff changeset
   228
            //check for javadoc comment of corresponding field.
06bc494ca11e Initial load
duke
parents:
diff changeset
   229
            Comment comment = matchingField.comment();
06bc494ca11e Initial load
duke
parents:
diff changeset
   230
            if (comment != null) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   231
                return comment.commentText();
06bc494ca11e Initial load
duke
parents:
diff changeset
   232
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   233
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   234
        return description;
06bc494ca11e Initial load
duke
parents:
diff changeset
   235
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   236
06bc494ca11e Initial load
duke
parents:
diff changeset
   237
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   238
     * Return the kind of this tag.
06bc494ca11e Initial load
duke
parents:
diff changeset
   239
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   240
    public String kind() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   241
        return "@serialField";
06bc494ca11e Initial load
duke
parents:
diff changeset
   242
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   243
06bc494ca11e Initial load
duke
parents:
diff changeset
   244
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   245
     * Convert this object to a string.
06bc494ca11e Initial load
duke
parents:
diff changeset
   246
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   247
    public String toString() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   248
        return name + ":" + text;
06bc494ca11e Initial load
duke
parents:
diff changeset
   249
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   250
06bc494ca11e Initial load
duke
parents:
diff changeset
   251
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   252
     * Compares this Object with the specified Object for order.  Returns a
06bc494ca11e Initial load
duke
parents:
diff changeset
   253
     * negative integer, zero, or a positive integer as this Object is less
06bc494ca11e Initial load
duke
parents:
diff changeset
   254
     * than, equal to, or greater than the given Object.
06bc494ca11e Initial load
duke
parents:
diff changeset
   255
     * <p>
06bc494ca11e Initial load
duke
parents:
diff changeset
   256
     * Included to make SerialFieldTagImpl items java.lang.Comparable.
06bc494ca11e Initial load
duke
parents:
diff changeset
   257
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   258
     * @param   obj the <code>Object</code> to be compared.
06bc494ca11e Initial load
duke
parents:
diff changeset
   259
     * @return  a negative integer, zero, or a positive integer as this Object
06bc494ca11e Initial load
duke
parents:
diff changeset
   260
     *          is less than, equal to, or greater than the given Object.
06bc494ca11e Initial load
duke
parents:
diff changeset
   261
     * @exception ClassCastException the specified Object's type prevents it
06bc494ca11e Initial load
duke
parents:
diff changeset
   262
     *            from being compared to this Object.
06bc494ca11e Initial load
duke
parents:
diff changeset
   263
     * @since 1.2
06bc494ca11e Initial load
duke
parents:
diff changeset
   264
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   265
    public int compareTo(Object obj) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   266
        return key().compareTo(((SerialFieldTagImpl)obj).key());
06bc494ca11e Initial load
duke
parents:
diff changeset
   267
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   268
}