Example #1
0
  private List<? extends BodyElement> createBodyElements(
      Context context, SeeTag tag, Object target) {
    if (target instanceof LinkTarget) {
      if (target instanceof Body && tag.label().equals("!!inline!!")) {
        Body body = (Body) target;
        EList<BodyElement> elements = body.getElements();
        resolve(context, elements);

        List<BodyElement> inlined = new ArrayList<BodyElement>();
        for (BodyElement element : elements) {
          inlined.add(element.copy());
        }

        return inlined;
      }

      return Collections.singletonList(new LinkImpl(tag, (LinkTarget) target));
    }

    if (target instanceof EmbeddableElement) {
      return Collections.singletonList(new EmbeddingImpl(tag, (EmbeddableElement) target));
    }

    return null;
  }
Example #2
0
  private List<? extends BodyElement> resolveSeeTag(Context context, SeeTag tag) {
    MemberDoc referencedMember = tag.referencedMember();
    if (referencedMember != null) {
      Object target = context.lookup(referencedMember);
      if (target != null) {
        return createBodyElements(context, tag, target);
      }
    }

    ClassDoc referencedClass = tag.referencedClass();
    if (referencedClass != null) {
      Object target = context.lookup(referencedClass);
      if (target == null) {
        target = resolveJavaElement(context, referencedClass, referencedMember);
      }

      if (target != null) {
        return createBodyElements(context, tag, target);
      }
    }

    return null;
  }