コード例 #1
0
 private void addTagToMethod(
     Map<String, MethodInfo> methods, String tagText, MethodTagType tagType) {
   MethodInfo mi = methods.get(methodName);
   if (mi == null) {
     mi = new MethodInfo();
     methods.put(methodName, mi);
   }
   if (tagType == MethodTagType.OMIT_FROM_UI) {
     mi.omitFromUI = true;
     return;
   }
   String[] tagParts =
       Iterables.toArray(
           Splitter.on(WHITESPACE_PATTERN)
               .trimResults()
               .omitEmptyStrings()
               .limit(2)
               .split(tagText),
           String.class);
   if (tagParts.length == 2) {
     if (tagType == MethodTagType.DESCRIPTION) {
       mi.descriptions.put(tagParts[0], tagParts[1]);
     } else {
       mi.useSchemas.put(tagParts[0], tagParts[1]);
     }
   }
 }
コード例 #2
0
 @Override
 public void endElement(String uri, String localName, String qName) throws SAXException {
   if (qName.equalsIgnoreCase("class")) {
     classInfo.put(className, oci);
     className = null;
     oci = null;
   } else if (qName.equalsIgnoreCase("comment") && oci != null) {
     if (methodName != null) {
       // do nothing
       if (isGetter(methodName)) {
         MethodInfo mi = oci.getMethods.get(methodName);
         if (mi == null) {
           mi = new MethodInfo();
           oci.getMethods.put(methodName, mi);
         }
         mi.comment = comment.toString();
       } else if (isSetter(methodName)) {
         MethodInfo mi = oci.setMethods.get(methodName);
         if (mi == null) {
           mi = new MethodInfo();
           oci.setMethods.put(methodName, mi);
         }
         mi.comment = comment.toString();
       }
     } else if (fieldName != null) {
       oci.fields.put(fieldName, comment.toString());
     } else {
       oci.comment = comment.toString();
     }
     comment = null;
   } else if (qName.equalsIgnoreCase("field")) {
     fieldName = null;
   } else if (qName.equalsIgnoreCase("method")) {
     methodName = null;
   }
 }