com.sun.javadoc.FieldDoc Java Examples

The following examples show how to use com.sun.javadoc.FieldDoc. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Parser.java    From xml-doclet with Apache License 2.0 6 votes vote down vote up
protected Field parseField(FieldDoc fieldDoc) {
	Field fieldNode = objectFactory.createField();
	fieldNode.setType(parseTypeInfo(fieldDoc.type()));
	fieldNode.setName(fieldDoc.name());
	fieldNode.setQualified(fieldDoc.qualifiedName());
	String comment = fieldDoc.commentText();
	if (comment.length() > 0) {
		fieldNode.setComment(comment);
	}
	fieldNode.setScope(parseScope(fieldDoc));
	fieldNode.setFinal(fieldDoc.isFinal());
	fieldNode.setStatic(fieldDoc.isStatic());
	fieldNode.setVolatile(fieldDoc.isVolatile());
	fieldNode.setTransient(fieldDoc.isTransient());
	fieldNode.setConstant(fieldDoc.constantValueExpression());

	for (AnnotationDesc annotationDesc : fieldDoc.annotations()) {
		fieldNode.getAnnotation().add(parseAnnotationDesc(annotationDesc, fieldDoc.qualifiedName()));
	}

	for (Tag tag : fieldDoc.tags()) {
		fieldNode.getTag().add(parseTag(tag));
	}

	return fieldNode;
}
 
Example #2
Source File: PSItemDoc.java    From PrivacyStreams with Apache License 2.0 6 votes vote down vote up
private PSItemDoc(ClassDoc classDoc) {
    this.classDoc = classDoc;
    this.name = classDoc.name();
    this.description = classDoc.commentText();
    this.itemFieldDocs = new ArrayList<>();
    this.providerDocs = new ArrayList<>();

    List<FieldDoc> allFields = new ArrayList<>();
    this.getAllFieldDocs(classDoc, allFields);

    for (FieldDoc fieldDoc : allFields) {
        PSItemFieldDoc itemFieldDoc = PSItemFieldDoc.build(this, fieldDoc);
        if (itemFieldDoc != null) this.itemFieldDocs.add(itemFieldDoc);
    }

    for (MethodDoc methodDoc : classDoc.methods()) {
        PSOperatorDoc providerDoc = PSOperatorDoc.build(classDoc, methodDoc);
        if (providerDoc != null) this.providerDocs.add(providerDoc);
    }
}
 
Example #3
Source File: Parser.java    From xml-doclet with Apache License 2.0 6 votes vote down vote up
/**
 * Parses an enum type definition
 * 
 * @param fieldDoc
 * @return
 */
protected EnumConstant parseEnumConstant(FieldDoc fieldDoc) {
	EnumConstant enumConstant = objectFactory.createEnumConstant();
	enumConstant.setName(fieldDoc.name());
	String comment = fieldDoc.commentText();
	if (comment.length() > 0) {
		enumConstant.setComment(comment);
	}

	for (AnnotationDesc annotationDesc : fieldDoc.annotations()) {
		enumConstant.getAnnotation().add(parseAnnotationDesc(annotationDesc, fieldDoc.qualifiedName()));
	}

	for (Tag tag : fieldDoc.tags()) {
		enumConstant.getTag().add(parseTag(tag));
	}

	return enumConstant;
}
 
Example #4
Source File: SarlFieldWriter.java    From sarl with Apache License 2.0 6 votes vote down vote up
@Override
public Content getSignature(FieldDoc field) {
	final Content pre = new HtmlTree(HtmlTag.PRE);
	addAnnotations(field, pre);
	addModifiers(field, pre);
	if ((field.modifierSpecifier() & Modifier.FINAL) != 0) {
		pre.addContent(Utils.keyword(Utils.getKeywords().getValKeyword()));
	} else {
		pre.addContent(Utils.keyword(Utils.getKeywords().getVarKeyword()));
	}
	pre.addContent(this.writer.getSpace());
	if (this.configuration.linksource) {
		final Content fieldName = new StringContent(field.name());
		this.writer.addSrcLink(field, fieldName, pre);
	} else {
		addName(field.name(), pre);
	}
	pre.addContent(this.writer.getSpace());
	pre.addContent(Utils.getKeywords().getColonKeyword());
	pre.addContent(" "); //$NON-NLS-1$
	final  Content fieldlink = this.writer.getLink(new LinkInfoImpl(
			this.configuration, LinkInfoImpl.Kind.MEMBER, field.type()));
	pre.addContent(fieldlink);
	return pre;
}
 
Example #5
Source File: BaleenJavadoc.java    From baleen with Apache License 2.0 6 votes vote down vote up
protected static String processExternalResources(ClassDoc classDoc) {
  StringBuilder cpText =
      new StringBuilder(
          "<dt><b>Configuration Parameters:</b></dt><dd><table><tr style=\"text-align: left\"><th>Parameter</th><th>Description</th><th>Default Value(s)</th></tr>");
  Map<String, String> rows = new TreeMap<>();

  for (FieldDoc field : getFields(classDoc)) {
    Entry<String, String> entry = createParameterRow(field);
    if (entry != null) {
      rows.put(entry.getKey(), entry.getValue());
    }
  }

  if (rows.isEmpty()) {
    cpText.setLength(0);
  } else {
    for (String s : rows.values()) {
      cpText.append(s);
    }
  }

  cpText.append("</table></dd>");
  return cpText.toString();
}
 
Example #6
Source File: BaleenJavadoc.java    From baleen with Apache License 2.0 6 votes vote down vote up
protected static String processConfigurationParameters(ClassDoc classDoc) {
  StringBuilder erText = new StringBuilder("<dt><b>External Resources:</b></dt><dd><ul>");

  List<String> resources = new ArrayList<>();
  for (FieldDoc field : getFields(classDoc)) {
    resources.addAll(createResourceItem(field));
  }

  if (resources.isEmpty()) {
    return null;
  } else {
    for (String s : resources) {
      erText.append(wrapWithTag("li", s, null));
    }
  }

  erText.append("</ul></dd>");
  return erText.toString();
}
 
Example #7
Source File: BaleenJavadoc.java    From baleen with Apache License 2.0 6 votes vote down vote up
private static Entry<String, String> createParameterRow(FieldDoc field) {
  Tag[] tags = field.tags("@" + ConfigurationParameters.NAME);
  if (tags.length == 0) {
    return null;
  }

  String name = wrapWithTag("td", field.constantValue(), "padding-right: 20px");
  String desc = wrapWithTag("td", field.commentText(), "padding-right: 20px");

  StringBuilder defaultValues = new StringBuilder("");
  for (Tag tag : tags) {
    defaultValues.append(tag.text());
    defaultValues.append("<br />");
  }
  String values = wrapWithTag("td", defaultValues.toString(), null);

  String row = wrapWithTag("tr", name + desc + values, null);

  return new AbstractMap.SimpleEntry<>(field.constantValue().toString(), row);
}
 
Example #8
Source File: PSItemFieldDoc.java    From PrivacyStreams with Apache License 2.0 5 votes vote down vote up
public static PSItemFieldDoc build(PSItemDoc psItemDoc, FieldDoc fieldDoc) {
    AnnotationDesc[] annotations = fieldDoc.annotations();
    for (AnnotationDesc annotation : annotations) {
        AnnotationTypeDoc annotationType = annotation.annotationType();
        if (Consts.ITEM_FIELD_ANNOTATION.equals(annotationType.toString())) {
            return new PSItemFieldDoc(psItemDoc, fieldDoc, annotation);
        }
    }
    return null;
}
 
Example #9
Source File: Parser.java    From xml-doclet with Apache License 2.0 5 votes vote down vote up
protected Interface parseInterface(ClassDoc classDoc) {

		Interface interfaceNode = objectFactory.createInterface();
		interfaceNode.setName(classDoc.name());
		interfaceNode.setQualified(classDoc.qualifiedName());
		String comment = classDoc.commentText();
		if (comment.length() > 0) {
			interfaceNode.setComment(comment);
		}
		interfaceNode.setIncluded(classDoc.isIncluded());
		interfaceNode.setScope(parseScope(classDoc));

		for (TypeVariable typeVariable : classDoc.typeParameters()) {
			interfaceNode.getGeneric().add(parseTypeParameter(typeVariable));
		}

		for (Type interfaceType : classDoc.interfaceTypes()) {
			interfaceNode.getInterface().add(parseTypeInfo(interfaceType));
		}

		for (MethodDoc method : classDoc.methods()) {
			interfaceNode.getMethod().add(parseMethod(method));
		}

		for (AnnotationDesc annotationDesc : classDoc.annotations()) {
			interfaceNode.getAnnotation().add(parseAnnotationDesc(annotationDesc, classDoc.qualifiedName()));
		}

		for (Tag tag : classDoc.tags()) {
			interfaceNode.getTag().add(parseTag(tag));
		}

		for (FieldDoc field : classDoc.fields()) {
			interfaceNode.getField().add(parseField(field));
		}

		return interfaceNode;
	}
 
Example #10
Source File: Parser.java    From xml-doclet with Apache License 2.0 5 votes vote down vote up
protected Enum parseEnum(ClassDoc classDoc) {
	Enum enumNode = objectFactory.createEnum();
	enumNode.setName(classDoc.name());
	enumNode.setQualified(classDoc.qualifiedName());
	String comment = classDoc.commentText();
	if (comment.length() > 0) {
		enumNode.setComment(comment);
	}
	enumNode.setIncluded(classDoc.isIncluded());
	enumNode.setScope(parseScope(classDoc));

	Type superClassType = classDoc.superclassType();
	if (superClassType != null) {
		enumNode.setClazz(parseTypeInfo(superClassType));
	}

	for (Type interfaceType : classDoc.interfaceTypes()) {
		enumNode.getInterface().add(parseTypeInfo(interfaceType));
	}

	for (FieldDoc field : classDoc.enumConstants()) {
		enumNode.getConstant().add(parseEnumConstant(field));
	}

	for (AnnotationDesc annotationDesc : classDoc.annotations()) {
		enumNode.getAnnotation().add(parseAnnotationDesc(annotationDesc, classDoc.qualifiedName()));
	}

	for (Tag tag : classDoc.tags()) {
		enumNode.getTag().add(parseTag(tag));
	}

	return enumNode;
}
 
Example #11
Source File: EnforcementDoclet.java    From spacewalk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * start the doclet
 * @param root the document root
 * @return boolean
 * @throws Exception e
 */
public static boolean start(RootDoc root) throws Exception {
    ClassDoc[] classes = root.classes();
    initializeExceptions();
    boolean found = false;

    for (ClassDoc clas : classes) {

        ClassDoc parent = clas.findClass("org.apache.struts.action.Action");
        if (parent == null) {
            System.out.println("Skipping " + clas.name());
            continue;
        }

        if (clas.subclassOf(parent)) {
            for (FieldDoc field : clas.fields()) {
                if (!field.isFinal() && !hasException(clas.name(), field.name())) {
                    found = true;
                    System.out.println("WARNING: Action Class " + clas.name() +
                            " has member: " + field.name());
                }
            }
        }
    }
    if (found) {
        throw new InvalidObjectException("Found non-final, non-exempt member " +
                "variables in one or more Action classes.  See Warnings " +
                "above for more information.");
    }
    return true;
}
 
Example #12
Source File: ProgrammaticWrappingProxyInstaller.java    From sarl with Apache License 2.0 5 votes vote down vote up
/** Wrap a field doc.
 *
 * @param source the source
 * @return the wrapper.
 */
public FieldDoc[] wrap(FieldDoc[] source) {
	if (source == null) {
		return null;
	}
	final List<FieldDoc> list = new ArrayList<>();
	for (final FieldDoc element : source) {
		if (isIncluded(element)) {
			list.add(wrap(element));
		}
	}
	return Utils.toArray(source, list);
}
 
Example #13
Source File: ProgrammaticWrappingProxyInstaller.java    From sarl with Apache License 2.0 5 votes vote down vote up
/** Wrap a field doc.
 *
 * @param source the source
 * @return the wrapper.
 */
public FieldDoc wrap(FieldDoc source) {
	if (source == null || source instanceof Proxy<?> || !(source instanceof FieldDocImpl)) {
		return source;
	}
	return new FieldDocWrapper((FieldDocImpl) source);
}
 
Example #14
Source File: FieldDocumentation.java    From spring-auto-restdocs with Apache License 2.0 5 votes vote down vote up
public static FieldDocumentation fromFieldDoc(FieldDoc fieldDoc) {
    FieldDocumentation fd = new FieldDocumentation();
    fd.comment = fieldDoc.commentText();

    for (Tag tag : fieldDoc.tags()) {
        fd.tags.put(cleanupTagName(tag.name()), tag.text());
    }

    return fd;
}
 
Example #15
Source File: PSItemFieldDoc.java    From PrivacyStreams with Apache License 2.0 5 votes vote down vote up
private PSItemFieldDoc(PSItemDoc psItemDoc, FieldDoc fieldDoc, AnnotationDesc annotation) {
    this.psItemDoc = psItemDoc;
    this.reference = fieldDoc.name();
    this.name = fieldDoc.constantValue().toString();
    this.description = fieldDoc.commentText().replace('\n', ' ');

    for (AnnotationDesc.ElementValuePair elementValuePair : annotation.elementValues()) {
        if ("type".equals(elementValuePair.element().name())) {
            Object typeValue = elementValuePair.value().value();
            this.type = (Type) typeValue;
        }
    }
}
 
Example #16
Source File: ClassDocumentation.java    From spring-auto-restdocs with Apache License 2.0 5 votes vote down vote up
public static ClassDocumentation fromClassDoc(ClassDoc classDoc) {
    ClassDocumentation cd = new ClassDocumentation();
    cd.setComment(classDoc.commentText());
    for (FieldDoc fieldDoc : classDoc.fields(false)) {
        cd.addField(fieldDoc);
    }
    for (MethodDoc methodDoc : classDoc.methods(false)) {
        cd.addMethod(methodDoc);
    }
    return cd;
}
 
Example #17
Source File: BaleenJavadoc.java    From baleen with Apache License 2.0 5 votes vote down vote up
private static List<String> createResourceItem(FieldDoc field) {
  Tag[] tags = field.tags("@" + ExternalResources.NAME);
  if (tags.length == 0) {
    return Collections.emptyList();
  }

  List<String> ret = new ArrayList<>();

  String pkg = field.containingPackage().name();
  int levels = pkg.length() - pkg.replaceAll("\\.", "").length() + 1;

  StringBuilder linkLevels = new StringBuilder("");
  for (int i = 0; i < levels; i++) {
    linkLevels.append("../");
  }

  for (Tag tag : tags) {
    ret.add(
        "<a href=\""
            + linkLevels.toString()
            + tag.text().replaceAll("\\.", "/")
            + ".html\">"
            + tag.text()
            + "</a> (key = "
            + field.constantValue()
            + ")");
  }

  return ret;
}
 
Example #18
Source File: PSItemDoc.java    From PrivacyStreams with Apache License 2.0 5 votes vote down vote up
private void getAllFieldDocs(ClassDoc classDoc, List<FieldDoc> fieldDocs) {
    if (classDoc.superclass() != null) {
        this.getAllFieldDocs(classDoc.superclass(), fieldDocs);
    }
    if (isValidPSItem(classDoc)) {
        fieldDocs.addAll(Arrays.asList(classDoc.fields()));
    }
}
 
Example #19
Source File: T8147801.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
void dump(PrintWriter out, String prefix, ClassDoc cd) {
    out.println(prefix + "class: " + cd);
    for (FieldDoc fd: cd.fields()) {
        out.println(prefix + "  " + fd);
        if (fd.type().asClassDoc() != null) {
            dump(out, prefix + "    ", fd.type().asClassDoc());
        }
    }
}
 
Example #20
Source File: AbstractBaleenTaglet.java    From baleen with Apache License 2.0 5 votes vote down vote up
/** Return a list of fields for this class and all it's superclasses */
protected static List<FieldDoc> getFields(ClassDoc classDoc) {
  List<FieldDoc> ret = new ArrayList<>();
  ClassDoc parent = classDoc.superclass();
  if (parent != null) {
    ret.addAll(getFields(parent));
  }

  ret.addAll(Arrays.asList(classDoc.fields()));

  return ret;
}
 
Example #21
Source File: ProgrammaticWrappingProxyInstaller.java    From sarl with Apache License 2.0 4 votes vote down vote up
@Override
public FieldDoc[] fields(boolean arg0) {
	return wrap(this.delegate.fields(arg0));
}
 
Example #22
Source File: Parser.java    From xml-doclet with Apache License 2.0 4 votes vote down vote up
protected Class parseClass(ClassDoc classDoc) {

		Class classNode = objectFactory.createClass();
		classNode.setName(classDoc.name());
		classNode.setQualified(classDoc.qualifiedName());
		String comment = classDoc.commentText();
		if (comment.length() > 0) {
			classNode.setComment(comment);
		}
		classNode.setAbstract(classDoc.isAbstract());
		classNode.setError(classDoc.isError());
		classNode.setException(classDoc.isException());
		classNode.setExternalizable(classDoc.isExternalizable());
		classNode.setIncluded(classDoc.isIncluded());
		classNode.setSerializable(classDoc.isSerializable());
		classNode.setScope(parseScope(classDoc));

		for (TypeVariable typeVariable : classDoc.typeParameters()) {
			classNode.getGeneric().add(parseTypeParameter(typeVariable));
		}

		Type superClassType = classDoc.superclassType();
		if (superClassType != null) {
			classNode.setClazz(parseTypeInfo(superClassType));
		}

		for (Type interfaceType : classDoc.interfaceTypes()) {
			classNode.getInterface().add(parseTypeInfo(interfaceType));
		}

		for (MethodDoc method : classDoc.methods()) {
			classNode.getMethod().add(parseMethod(method));
		}

		for (AnnotationDesc annotationDesc : classDoc.annotations()) {
			classNode.getAnnotation().add(parseAnnotationDesc(annotationDesc, classDoc.qualifiedName()));
		}

		for (ConstructorDoc constructor : classDoc.constructors()) {
			classNode.getConstructor().add(parseConstructor(constructor));
		}

		for (FieldDoc field : classDoc.fields()) {
			classNode.getField().add(parseField(field));
		}

		for (Tag tag : classDoc.tags()) {
			classNode.getTag().add(parseTag(tag));
		}

		return classNode;
	}
 
Example #23
Source File: RootDocProcessor.java    From hadoop with Apache License 2.0 4 votes vote down vote up
@Override
   public Object invoke(Object proxy, Method method, Object[] args)
throws Throwable {
     String methodName = method.getName();
     if (target instanceof Doc) {
if (methodName.equals("isIncluded")) {
  Doc doc = (Doc) target;
  return !exclude(doc) && doc.isIncluded();
}
if (target instanceof RootDoc) {
  if (methodName.equals("classes")) {
    return filter(((RootDoc) target).classes(), ClassDoc.class);
  } else if (methodName.equals("specifiedClasses")) {
    return filter(((RootDoc) target).specifiedClasses(), ClassDoc.class);
  } else if (methodName.equals("specifiedPackages")) {
    return filter(((RootDoc) target).specifiedPackages(), PackageDoc.class);
  }
} else if (target instanceof ClassDoc) {
  if (isFiltered(args)) {
    if (methodName.equals("methods")) {
      return filter(((ClassDoc) target).methods(true), MethodDoc.class);
    } else if (methodName.equals("fields")) {
      return filter(((ClassDoc) target).fields(true), FieldDoc.class);
    } else if (methodName.equals("innerClasses")) {
      return filter(((ClassDoc) target).innerClasses(true),
	  ClassDoc.class);
    } else if (methodName.equals("constructors")) {
      return filter(((ClassDoc) target).constructors(true),
	  ConstructorDoc.class);
    }
  }
} else if (target instanceof PackageDoc) {
  if (methodName.equals("allClasses")) {
    if (isFiltered(args)) {
      return filter(((PackageDoc) target).allClasses(true),
	ClassDoc.class);
    } else {
      return filter(((PackageDoc) target).allClasses(), ClassDoc.class);  
    }
  } else if (methodName.equals("annotationTypes")) {
    return filter(((PackageDoc) target).annotationTypes(),
	AnnotationTypeDoc.class);
  } else if (methodName.equals("enums")) {
    return filter(((PackageDoc) target).enums(),
	ClassDoc.class);
  } else if (methodName.equals("errors")) {
    return filter(((PackageDoc) target).errors(),
	ClassDoc.class);
  } else if (methodName.equals("exceptions")) {
    return filter(((PackageDoc) target).exceptions(),
	ClassDoc.class);
  } else if (methodName.equals("interfaces")) {
    return filter(((PackageDoc) target).interfaces(),
	ClassDoc.class);
  } else if (methodName.equals("ordinaryClasses")) {
    return filter(((PackageDoc) target).ordinaryClasses(),
	ClassDoc.class);
  }
}
     }

     if (args != null) {
if (methodName.equals("compareTo") || methodName.equals("equals")
    || methodName.equals("overrides")
    || methodName.equals("subclassOf")) {
  args[0] = unwrap(args[0]);
}
     }
     try {
return process(method.invoke(target, args), method.getReturnType());
     } catch (InvocationTargetException e) {
throw e.getTargetException();
     }
   }
 
Example #24
Source File: Parser.java    From xml-doclet with Apache License 2.0 4 votes vote down vote up
/**
 * Parses annotation instances of an annotable program element
 * 
 * @param annotationDesc
 *            annotationDesc
 * @param programElement
 *            programElement
 * @return representation of annotations
 */
protected AnnotationInstance parseAnnotationDesc(AnnotationDesc annotationDesc, String programElement) {
	AnnotationInstance annotationInstanceNode = objectFactory.createAnnotationInstance();

	try {
		AnnotationTypeDoc annotTypeInfo = annotationDesc.annotationType();
		annotationInstanceNode.setName(annotTypeInfo.name());
		annotationInstanceNode.setQualified(annotTypeInfo.qualifiedTypeName());
	} catch (ClassCastException castException) {
		log.error("Unable to obtain type data about an annotation found on: " + programElement);
		log.error("Add to the classpath the class/jar that defines this annotation.");
	}

	for (AnnotationDesc.ElementValuePair elementValuesPair : annotationDesc.elementValues()) {
		AnnotationArgument annotationArgumentNode = objectFactory.createAnnotationArgument();
		annotationArgumentNode.setName(elementValuesPair.element().name());

		Type annotationArgumentType = elementValuesPair.element().returnType();
		annotationArgumentNode.setType(parseTypeInfo(annotationArgumentType));
		annotationArgumentNode.setPrimitive(annotationArgumentType.isPrimitive());
		annotationArgumentNode.setArray(annotationArgumentType.dimension().length() > 0);

		Object objValue = elementValuesPair.value().value();
		if (objValue instanceof AnnotationValue[]) {
			for (AnnotationValue annotationValue : (AnnotationValue[]) objValue) {
			    if (annotationValue.value() instanceof AnnotationDesc) {
                       AnnotationDesc annoDesc = (AnnotationDesc) annotationValue.value();
                       annotationArgumentNode.getAnnotation().add(parseAnnotationDesc(annoDesc, programElement));
                   } else {
                       annotationArgumentNode.getValue().add(annotationValue.value().toString());
                   }
			}
		} else if (objValue instanceof FieldDoc) {
			annotationArgumentNode.getValue().add(((FieldDoc) objValue).name());
		} else if (objValue instanceof ClassDoc) {
			annotationArgumentNode.getValue().add(((ClassDoc) objValue).qualifiedTypeName());
		} else {
			annotationArgumentNode.getValue().add(objValue.toString());
		}
		annotationInstanceNode.getArgument().add(annotationArgumentNode);
	}

	return annotationInstanceNode;
}
 
Example #25
Source File: RootDocProcessor.java    From big-c with Apache License 2.0 4 votes vote down vote up
@Override
   public Object invoke(Object proxy, Method method, Object[] args)
throws Throwable {
     String methodName = method.getName();
     if (target instanceof Doc) {
if (methodName.equals("isIncluded")) {
  Doc doc = (Doc) target;
  return !exclude(doc) && doc.isIncluded();
}
if (target instanceof RootDoc) {
  if (methodName.equals("classes")) {
    return filter(((RootDoc) target).classes(), ClassDoc.class);
  } else if (methodName.equals("specifiedClasses")) {
    return filter(((RootDoc) target).specifiedClasses(), ClassDoc.class);
  } else if (methodName.equals("specifiedPackages")) {
    return filter(((RootDoc) target).specifiedPackages(), PackageDoc.class);
  }
} else if (target instanceof ClassDoc) {
  if (isFiltered(args)) {
    if (methodName.equals("methods")) {
      return filter(((ClassDoc) target).methods(true), MethodDoc.class);
    } else if (methodName.equals("fields")) {
      return filter(((ClassDoc) target).fields(true), FieldDoc.class);
    } else if (methodName.equals("innerClasses")) {
      return filter(((ClassDoc) target).innerClasses(true),
	  ClassDoc.class);
    } else if (methodName.equals("constructors")) {
      return filter(((ClassDoc) target).constructors(true),
	  ConstructorDoc.class);
    }
  }
} else if (target instanceof PackageDoc) {
  if (methodName.equals("allClasses")) {
    if (isFiltered(args)) {
      return filter(((PackageDoc) target).allClasses(true),
	ClassDoc.class);
    } else {
      return filter(((PackageDoc) target).allClasses(), ClassDoc.class);  
    }
  } else if (methodName.equals("annotationTypes")) {
    return filter(((PackageDoc) target).annotationTypes(),
	AnnotationTypeDoc.class);
  } else if (methodName.equals("enums")) {
    return filter(((PackageDoc) target).enums(),
	ClassDoc.class);
  } else if (methodName.equals("errors")) {
    return filter(((PackageDoc) target).errors(),
	ClassDoc.class);
  } else if (methodName.equals("exceptions")) {
    return filter(((PackageDoc) target).exceptions(),
	ClassDoc.class);
  } else if (methodName.equals("interfaces")) {
    return filter(((PackageDoc) target).interfaces(),
	ClassDoc.class);
  } else if (methodName.equals("ordinaryClasses")) {
    return filter(((PackageDoc) target).ordinaryClasses(),
	ClassDoc.class);
  }
}
     }

     if (args != null) {
if (methodName.equals("compareTo") || methodName.equals("equals")
    || methodName.equals("overrides")
    || methodName.equals("subclassOf")) {
  args[0] = unwrap(args[0]);
}
     }
     try {
return process(method.invoke(target, args), method.getReturnType());
     } catch (InvocationTargetException e) {
throw e.getTargetException();
     }
   }
 
Example #26
Source File: ProgrammaticWrappingProxyInstaller.java    From sarl with Apache License 2.0 4 votes vote down vote up
@Override
public FieldDoc findField(String fieldName) {
	return wrap(this.delegate.findField(fieldName));
}
 
Example #27
Source File: ProgrammaticWrappingProxyInstaller.java    From sarl with Apache License 2.0 4 votes vote down vote up
@Override
public FieldDoc[] serializableFields() {
	return wrap(this.delegate.serializableFields());
}
 
Example #28
Source File: ClassDocumentation.java    From spring-auto-restdocs with Apache License 2.0 4 votes vote down vote up
private void addField(FieldDoc fieldDoc) {
    this.fields.put(fieldDoc.name(), FieldDocumentation.fromFieldDoc(fieldDoc));
}
 
Example #29
Source File: ProgrammaticWrappingProxyInstaller.java    From sarl with Apache License 2.0 4 votes vote down vote up
@Override
public FieldDoc[] fields() {
	return wrap(this.delegate.fields());
}
 
Example #30
Source File: ProgrammaticWrappingProxyInstaller.java    From sarl with Apache License 2.0 4 votes vote down vote up
@Override
public FieldDoc[] enumConstants() {
	return wrap(this.delegate.enumConstants());
}