src/share/classes/com/sun/tools/doclets/internal/toolkit/util/Util.java

changeset 1606
ccbe7ffdd867
parent 1521
71f35e4b93a5
child 1746
bd51ca92c013
     1.1 --- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/Util.java	Fri Feb 22 18:19:51 2013 +0000
     1.2 +++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/Util.java	Sun Feb 24 11:36:58 2013 -0800
     1.3 @@ -722,6 +722,56 @@
     1.4      }
     1.5  
     1.6      /**
     1.7 +     * A convenience method to get property name from the name of the
     1.8 +     * getter or setter method.
     1.9 +     * @param name name of the getter or setter method.
    1.10 +     * @return the name of the property of the given setter of getter.
    1.11 +     */
    1.12 +    public static String propertyNameFromMethodName(String name) {
    1.13 +        String propertyName = null;
    1.14 +        if (name.startsWith("get") || name.startsWith("set")) {
    1.15 +            propertyName = name.substring(3);
    1.16 +        } else if (name.startsWith("is")) {
    1.17 +            propertyName = name.substring(2);
    1.18 +        }
    1.19 +        if ((propertyName == null) || propertyName.isEmpty()){
    1.20 +            return "";
    1.21 +        }
    1.22 +        return propertyName.substring(0, 1).toLowerCase()
    1.23 +                + propertyName.substring(1);
    1.24 +    }
    1.25 +
    1.26 +    /**
    1.27 +     * In case of JavaFX mode on, filters out classes that are private,
    1.28 +     * package private or having the @treatAsPrivate annotation. Those are not
    1.29 +     * documented in JavaFX mode.
    1.30 +     *
    1.31 +     * @param classes array of classes to be filtered.
    1.32 +     * @param javafx set to true if in JavaFX mode.
    1.33 +     * @return list of filtered classes.
    1.34 +     */
    1.35 +    public static ClassDoc[] filterOutPrivateClasses(final ClassDoc[] classes,
    1.36 +                                                     boolean javafx) {
    1.37 +        if (!javafx) {
    1.38 +            return classes;
    1.39 +        }
    1.40 +        final List<ClassDoc> filteredOutClasses =
    1.41 +                new ArrayList<ClassDoc>(classes.length);
    1.42 +        for (ClassDoc classDoc : classes) {
    1.43 +            if (classDoc.isPrivate() || classDoc.isPackagePrivate()) {
    1.44 +                continue;
    1.45 +            }
    1.46 +            Tag[] aspTags = classDoc.tags("treatAsPrivate");
    1.47 +            if (aspTags != null && aspTags.length > 0) {
    1.48 +                continue;
    1.49 +            }
    1.50 +            filteredOutClasses.add(classDoc);
    1.51 +        }
    1.52 +
    1.53 +        return filteredOutClasses.toArray(new ClassDoc[0]);
    1.54 +    }
    1.55 +
    1.56 +    /**
    1.57       * Test whether the given FieldDoc is one of the declaration annotation ElementTypes
    1.58       * defined in Java 5.
    1.59       * Instead of testing for one of the new enum constants added in Java 8, test for

mercurial