Package com.sun.javadoc

Examples of com.sun.javadoc.ClassDoc


            for (Edge edge: directEdges) {
                if (!useSee && edge.getType() == SEE_ALSO) {
                    continue;
                }

                ClassDoc source = (ClassDoc) edge.getSource();
                ClassDoc target = (ClassDoc) edge.getTarget();

                boolean excluded = false;
                if (forceInherit || cls.tags(TAG_INHERIT).length > 0) {
                    for (Tag t: pkg.tags(TAG_EXCLUDE)) {
                        Pattern p = Pattern.compile(t.text().trim());

                        if (p.matcher(source.qualifiedName()).find()) {
                            excluded = true;
                            break;
                        }
                        if (p.matcher(target.qualifiedName()).find()) {
                            excluded = true;
                            break;
                        }
                    }
                    if (excluded) {
                        continue;
                    }
                }

                for (Tag t: cls.tags(TAG_EXCLUDE)) {
                    Pattern p = Pattern.compile(t.text().trim());

                    if (p.matcher(source.qualifiedName()).find()) {
                        excluded = true;
                        break;
                    }
                    if (p.matcher(target.qualifiedName()).find()) {
                        excluded = true;
                        break;
                    }
                }
                if (excluded) {
                    continue;
                }

                if (!useHidden || source.tags(TAG_HIDDEN).length == 0 && target.tags(TAG_HIDDEN).length == 0) {
                    edgesToRender.add(edge);
                }
                if (!useHidden || source.tags(TAG_HIDDEN).length == 0) {
                    nodesToRender.put(source.qualifiedName(), source);
                }
                if (!useHidden || target.tags(TAG_HIDDEN).length == 0) {
                    nodesToRender.put(target.qualifiedName(), target);
                }
            }

            Set<Edge> reversedDirectEdges = reversedEdges.get(cls);
            if (reversedDirectEdges != null) {
                for (Edge edge: reversedDirectEdges) {
                    if (!useSee && edge.getType() == SEE_ALSO) {
                        continue;
                    }

                    ClassDoc source = (ClassDoc) edge.getSource();
                    ClassDoc target = (ClassDoc) edge.getTarget();

                    boolean excluded = false;
                    if (forceInherit || cls.tags(TAG_INHERIT).length > 0) {
                        for (Tag t: pkg.tags(TAG_EXCLUDE)) {
                            Pattern p = Pattern.compile(t.text().trim());

                            if (p.matcher(source.qualifiedName()).find()) {
                                excluded = true;
                                break;
                            }
                            if (p.matcher(target.qualifiedName()).find()) {
                                excluded = true;
                                break;
                            }
                        }
                        if (excluded) {
                            continue;
                        }
                    }

                    for (Tag t: cls.tags(TAG_EXCLUDE)) {
                        Pattern p = Pattern.compile(t.text().trim());

                        if (p.matcher(source.qualifiedName()).find()) {
                            excluded = true;
                            break;
                        }
                        if (p.matcher(target.qualifiedName()).find()) {
                            excluded = true;
                            break;
                        }
                    }
                    if (excluded) {
                        continue;
                    }

                    if (!useHidden || source.tags(TAG_HIDDEN).length == 0 && target.tags(TAG_HIDDEN).length == 0) {
                        edgesToRender.add(edge);
                    }
                    if (!useHidden || source.tags(TAG_HIDDEN).length == 0) {
                        nodesToRender.put(source.qualifiedName(), source);
                    }
                    if (!useHidden || target.tags(TAG_HIDDEN).length == 0) {
                        nodesToRender.put(target.qualifiedName(), target);
                    }
                }
            }
        }
    }
View Full Code Here


  private static boolean isJUnitTest(ClassDoc clsDoc) {
    if (clsDoc.isInterface()) {
      return false;
    }

    ClassDoc superCls = clsDoc.superclass();

    while (null != superCls
        && !"java.lang.Object".equals(superCls.qualifiedTypeName())) {
      if ("junit.framework.TestCase".equals(superCls.qualifiedTypeName())
          || "TestCase".equals(superCls.typeName())) {
        return true;
      }

      superCls = superCls.superclass();
    }

    return false;
  }
View Full Code Here

    String qualifiedClassName = objectClassDoc.qualifiedName ();
    instances.put (qualifiedClassName, this);

    objectClassInfo = new ClassInfo (objectClassDoc);

    ClassDoc identityBaseClassDoc;
    Tag [] tags = objectClassDoc.tags ("mariner-object-base-identity-class");
    // If a base identity class has been specified, try to use it
    // otherwise search for one.
    if(tags.length == 1) {
        String baseIdentityClassName = tags[0].text();
        identityBaseClassDoc = rootDoc.classNamed (baseIdentityClassName);
        if(identityBaseClassDoc == null) {
            throw new IllegalStateException("Cannot find base identity class" +
                baseIdentityClassName);
        }
    } else {
        identityBaseClassDoc = getIdentityBaseClassDoc (rootDoc,
                                                             objectClassDoc);
    }
   
    System.out.println("Using base class " + identityBaseClassDoc.qualifiedName());
    identityBaseClassInfo = new ClassInfo (identityBaseClassDoc);

    // Create a ClassInfo for the identity class.
    String identityClassName = objectClassInfo.getName () + "Identity";
    String identityClassQualifiedName
      = objectClassInfo.getQualifiedName () + "Identity";

    identityClassInfo = new ClassInfo (objectClassInfo.getPackageInfo (),
                                       identityBaseClassInfo,
                                       identityClassName,
                                       identityClassQualifiedName);

    allIdentityFields = new ArrayList ();
    // Find out whether this object has any dependencies.
    tags = objectClassDoc.tags ("mariner-object-guardian");
    if (tags.length == 1) {
      String guardianClass = tags [0].text ();
      ClassDoc guardianClassDoc = rootDoc.classNamed (guardianClass);
      if (guardianClassDoc == null) {
        throw new IllegalStateException ("Cannot find guardian class "
                                         + guardianClass);
      }
      guardianInfo = RepositoryObjectInfo.getInstance (rootDoc,
                                                       guardianClassDoc);
    } else if (tags.length > 1) {
      throw new IllegalStateException ("Class can only have one"
                                       + " mariner-object-guardian");
    }

    // Create an array of the new fields in the class.
    tags = objectClassDoc.tags ("mariner-object-identity-field");
    int identityFieldCount = tags.length;

    for (int i = 0; i < identityFieldCount; i += 1) {

      // Get the field name.
      String fieldName = tags [i].text ();

      FieldInfo identityField;

      // If it is inherited from the base class then ignore it.
      identityField = identityBaseClassInfo.getField (fieldName, true);
     
      if (identityField != null) {
        if (GenerateUtilities.isProjectField(identityField)) {
            projectIdentityField = identityField;
        }
        // Add it to the list of all the identity fields.
        allIdentityFields.add (identityField);
        continue;
      }

      // Get the details of the object's field.
      FieldInfo objectField = objectClassInfo.getField (fieldName, true);

      String comment = objectField.getComment ();
      comment = getConstructorParameterComment (objectClassDoc,
                                                fieldName,
                                                comment);

      // Create a field for the identity class.
      identityField = new FieldInfo (objectField, comment);

      // Add it to the class.
      identityClassInfo.addField (identityField);

      // Add it to the list of all the identity fields.
      allIdentityFields.add (identityField);

      // Get the details of the object's getter method.
      MethodInfo objectGetter = objectClassInfo.getGetterMethod (fieldName,
                                                                 true);
      MethodInfo identityGetter
        = new MethodInfo (objectGetter.getName (),
                          objectGetter.getReturnType (),
                          objectGetter.getComment ());

      // Add it to the class.
      identityClassInfo.addMethod (identityGetter);
    }

      // Create the list of parameters for the constructor.
    List constructorParameters = new ArrayList ();
    for (Iterator i = allIdentityFields.iterator (); i.hasNext ();) {
      FieldInfo field = (FieldInfo) i.next ();

      ParameterInfo parameter = new ParameterInfo (field.getClassInfo (),
                                                   field.getName (),
                                                   field.getType ());
      constructorParameters.add (parameter);
    }
   
    ConstructorInfo constructor = new ConstructorInfo (constructorParameters);
    identityClassInfo.addConstructor (constructor);

    // Get the list of extra identity fields.
    if (guardianInfo == null) {
      extraIdentityFields = new ArrayList (allIdentityFields);
    } else {
      ClassInfo guardianIdentityClassInfo
        = guardianInfo.getIdentityClassInfo ();

      extraIdentityFields = getExtraFields (allIdentityFields,
                                            guardianIdentityClassInfo);
    }

    // Create the set of the names of fields to ignore.
    Set ignore = new HashSet ();
    ignore.add ("identity");

    tags = objectClassDoc.tags ("mariner-object-ignore-field");
    for (int i = 0; i < tags.length; i += 1) {
      //System.out.println ("Field " + tags [i].text ()
      //+ " should be ignored");
      ignore.add (tags [i].text ());
    }

    // Initialise the list of object fields.
    allObjectFields = objectClassInfo.getAllInstanceFields ();
    for (Iterator i = allObjectFields.iterator (); i.hasNext ();) {
      FieldInfo field = (FieldInfo) i.next ();
      String fieldName = field.getName ();
      if (ignore.contains (fieldName)) {
        //System.out.println ("Ignoring " + fieldName);
        i.remove ();
      }
    }

    extraObjectFields = getExtraFields (allObjectFields, identityClassInfo);

    dependentsInfo = new ArrayList ();
    tags = objectClassDoc.tags ("mariner-object-dependent");
    for (int i = 0; i < tags.length; i += 1) {
      String dependentClassName = tags [i].text ();
      ClassDoc dependentClassDoc = rootDoc.classNamed (dependentClassName);
      if (dependentClassDoc == null) {
        throw new IllegalStateException ("Cannot find class named "
                                         + dependentClassName);
      }
View Full Code Here

            ClassDoc doc,
            String tagName,
            Set fieldHash) {

        // recurse through parent classes first
        ClassDoc baseClassDoc = doc.superclass();
        if (baseClassDoc != null) {
            recursivelyGetTags( baseClassDoc, tagName, fieldHash );
        }

        // get the documentation for this class
View Full Code Here

   * identity class.
   */
  private ClassDoc getIdentityBaseClassDoc (RootDoc rootDoc,
                                            ClassDoc objectClassDoc) {
   
    ClassDoc objectBaseClassDoc = objectClassDoc.superclass ();
    while (objectBaseClassDoc != null) {

      String qualifiedObjectBaseClassName
        = objectBaseClassDoc.qualifiedName ();
      String qualifiedIdentityBaseClassName
        = qualifiedObjectBaseClassName + "Identity";

      //System.out.println ("Trying " + qualifiedIdentityBaseClassName);
   
      ClassDoc identityBaseClassDoc
        = rootDoc.classNamed (qualifiedIdentityBaseClassName);
     
      if (identityBaseClassDoc != null) {
        return identityBaseClassDoc;
      }
View Full Code Here

  protected boolean processRootDoc () {

    ClassDoc [] classes = rootDoc.classes ();

    for (int i = 0; i < classes.length; i += 1) {
      ClassDoc objectClassDoc = classes [i];

      processClassDoc (objectClassDoc);
    }

    return true;
View Full Code Here

    this.classDoc = classDoc;

    packageInfo = new PackageInfo (classDoc.containingPackage ());

    ClassDoc baseClassDoc = classDoc.superclass ();
    if (baseClassDoc != null) {
      baseClassInfo = new ClassInfo (baseClassDoc);
    }

    this.name = classDoc.name ();
View Full Code Here

            summaryOut.printTestAPIComponentsSummary(testAPIComponents);
            summaryOut.close();
          

            for (int i = 0; i < testAPIComponents.length; i++) {
                ClassDoc classDoc = testAPIComponents[i];
                HTMLFileWriter out = new HTMLFileWriter(mDestinationDirectory + "components/" + classDoc.name() + ".html", classDoc.name(), true);
                out.printTestAPIComponentHeader(classDoc, root);
                out.printMethodsSummary(classDoc);
                out.printMethodsDetails(classDoc);
                out.close();
View Full Code Here

     * @param root the RootDoc passed to the doclet
     * @return true if specified class is a Test API component interface, false otherwise
     */
    public static boolean isTestAPI(ClassDoc classDoc, RootDoc root) {
        try {
          ClassDoc TestAPIComponent = root.classNamed(TEST_API_KERNEL_PACKAGE + ".Component");
          return classDoc.isInterface() && classDoc.subclassOf(TestAPIComponent) && (classDoc != TestAPIComponent);
        }       
        catch (Exception e) {
          return false;
        }
View Full Code Here

     * @param classDoc the ClassDoc specifying the class
     * @param root the RootDoc passed to the doclet
     * @return true if specified class is a Test API instance Id component interface, false otherwise
     */
    public static boolean isMultipleInstancesComponent(ClassDoc classDoc, RootDoc root) {
        ClassDoc TestAPIMultipleInstancesComponent = root.classNamed(TEST_API_KERNEL_PACKAGE + ".MultipleInstancesComponent");
        return classDoc.isInterface() && classDoc.subclassOf(TestAPIMultipleInstancesComponent) && (classDoc != TestAPIMultipleInstancesComponent);
    }
View Full Code Here

TOP

Related Classes of com.sun.javadoc.ClassDoc

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.