Exemplo n.º 1
0
 /**
  * Search for the given method in the given class.
  *
  * @param cd Class to search into.
  * @param method Method to be searched.
  * @return MethodDoc Method found, null otherwise.
  */
 public static MethodDoc findMethod(ClassDoc cd, MethodDoc method) {
   MethodDoc[] methods = cd.methods();
   for (int i = 0; i < methods.length; i++) {
     if (executableMembersEqual(method, methods[i])) {
       return methods[i];
     }
   }
   return null;
 }
Exemplo n.º 2
0
 /** The documentation for values() and valueOf() in Enums are set by the doclet. */
 public static void setEnumDocumentation(Configuration configuration, ClassDoc classDoc) {
   MethodDoc[] methods = classDoc.methods();
   for (int j = 0; j < methods.length; j++) {
     MethodDoc currentMethod = methods[j];
     if (currentMethod.name().equals("values") && currentMethod.parameters().length == 0) {
       currentMethod.setRawCommentText(
           configuration.getText("doclet.enum_values_doc", classDoc.name()));
     } else if (currentMethod.name().equals("valueOf") && currentMethod.parameters().length == 1) {
       Type paramType = currentMethod.parameters()[0].type();
       if (paramType != null && paramType.qualifiedTypeName().equals(String.class.getName())) {
         currentMethod.setRawCommentText(configuration.getText("doclet.enum_valueof_doc"));
       }
     }
   }
 }