1 5 package xdoclet.tagshandler; 6 7 import java.util.Properties ; 8 9 import xjavadoc.*; 10 import xdoclet.ConfigParamIntrospector; 11 12 import xdoclet.XDocletException; 13 14 20 public class FieldTagsHandler extends AbstractProgramElementTagsHandler 21 { 22 23 30 public static String getFieldTypeFor(XField field) throws XDocletException 31 { 32 return field.getType().getQualifiedName() + field.getDimensionAsString(); 33 } 34 35 42 public String getCapitalizedFieldName() throws XDocletException 43 { 44 return ConfigParamIntrospector.capitalize(getCurrentField().getName()); 45 } 46 47 59 public void forAllFields(String template, Properties attributes) throws XDocletException 60 { 61 forAllMembers(template, attributes, FOR_FIELD); 62 } 63 64 70 public String modifiers() throws XDocletException 71 { 72 return modifiers(FOR_FIELD); 73 } 74 75 82 public String firstSentenceDescriptionOfCurrentField() throws XDocletException 83 { 84 return firstSentenceDescriptionOfCurrentMember(getCurrentField()); 85 } 86 87 94 public String fieldName() throws XDocletException 95 { 96 return getCurrentField().getName(); 97 } 98 99 112 public String fieldComment(Properties attributes) throws XDocletException 113 { 114 return memberComment(attributes, FOR_FIELD); 115 } 116 117 128 public void forAllFieldTags(String template, Properties attributes) throws XDocletException 129 { 130 forAllMemberTags(template, attributes, FOR_FIELD, XDocletTagshandlerMessages.ONLY_CALL_FIELD_NOT_NULL, new String []{"forAllFieldTags"}); 131 } 132 133 145 public void forAllFieldTagTokens(String template, Properties attributes) throws XDocletException 146 { 147 forAllMemberTagTokens(template, attributes, FOR_FIELD); 148 } 149 150 168 public String fieldTagValue(Properties attributes) throws XDocletException 169 { 170 attributes.setProperty("field", "true"); 172 return getExpandedDelimitedTagValue(attributes, FOR_FIELD); 173 } 174 175 182 public String fieldType() throws XDocletException 183 { 184 return getFieldTypeFor(getCurrentField()); 185 } 186 187 203 public void ifHasFieldTag(String template, Properties attributes) throws XDocletException 204 { 205 if (hasTag(attributes, FOR_FIELD)) { 206 generate(template); 207 } 208 else { 209 String error = attributes.getProperty("error"); 210 211 if (error != null) { 212 getEngine().print(error); 213 } 214 } 215 } 216 217 231 public void ifDoesntHaveFieldTag(String template, Properties attributes) throws XDocletException 232 { 233 if (!hasTag(attributes, FOR_FIELD)) { 234 generate(template); 235 } 236 else { 237 String error = attributes.getProperty("error"); 238 239 if (error != null) { 240 getEngine().print(error); 241 } 242 } 243 } 244 245 259 public void ifFieldTagValueEquals(String template, Properties attributes) throws XDocletException 260 { 261 if (isTagValueEqual(attributes, FOR_FIELD)) { 262 generate(template); 263 } 264 } 265 266 } 267 | Popular Tags |