1 22 package org.aspectj.tools.ajdoc; 23 24 import com.sun.javadoc.ClassDoc; 25 import com.sun.javadoc.Doc; 26 import com.sun.javadoc.SerialFieldTag; 27 28 import java.util.Locale ; 29 30 35 public class SerialFieldTagImpl 36 extends TagImpl implements SerialFieldTag, 37 Comparable { 38 39 private String description; 40 private String fieldName; 41 private String fieldType; 42 private ClassDoc fieldTypeDoc; 43 44 54 public SerialFieldTagImpl(Doc doc, 55 String name, 56 String text, 57 Locale loc, 58 ErrPrinter err) { 59 super(doc, name, text, loc, err); 60 resolveNames(text); 61 } 62 63 68 public String description() { 69 return description; 70 } 71 72 77 public String fieldName() { 78 return fieldName; 79 } 80 81 86 public String fieldType() { 87 return fieldType; 88 } 89 90 95 public ClassDoc fieldTypeDoc() { 96 return fieldTypeDoc; 97 } 98 99 public int compareTo(Object other) { 102 return -1; 103 } 104 105 110 public String kind() { 111 return "@serialField"; 112 } 113 114 115 private void resolveNames(String str) { 116 if (str == null || (str = str.trim()).length() < 1) return; 120 final int N = str.length(); 121 122 int i = 0; 123 int start; 124 125 start = i; 127 if (i < N && !start(str.charAt(i++))) { 128 err().error("serialField_tag_invalid_field_name_start", 129 ""+str.charAt(i)); 130 return; 131 } 132 133 while (i < N && !space(str.charAt(i))) { 135 if (!ident(str.charAt(i))) { 136 err().error("serialField_tag_invalid_field_name_part", 137 ""+str.charAt(i)); 138 return; 139 } 140 i++; 141 } 142 143 fieldName = str.substring(start, i).trim(); 145 146 start = i; 148 if (i < N && !start(str.charAt(i++))) { 149 err().error("serialField_tag_invalid_type_name_start", 150 ""+str.charAt(i)); 151 return; 152 } 153 154 while (i < N && !space(str.charAt(i))) { 156 if (!(str.charAt(i) == '[' || 157 str.charAt(i) == ']' || 158 ident(str.charAt(i)))) { 159 err().error("serialField_tag_invalid_type_name_part", 160 ""+str.charAt(i)); 161 return; 162 } 163 } 164 165 fieldType = str.substring(start, i).trim(); 167 168 if (i < N) { 170 description = str.substring(i).trim(); 171 } 172 } 173 } 174 | Popular Tags |