720 } |
720 } |
721 return false; |
721 return false; |
722 } |
722 } |
723 |
723 |
724 /** |
724 /** |
|
725 * A convenience method to get property name from the name of the |
|
726 * getter or setter method. |
|
727 * @param name name of the getter or setter method. |
|
728 * @return the name of the property of the given setter of getter. |
|
729 */ |
|
730 public static String propertyNameFromMethodName(String name) { |
|
731 String propertyName = null; |
|
732 if (name.startsWith("get") || name.startsWith("set")) { |
|
733 propertyName = name.substring(3); |
|
734 } else if (name.startsWith("is")) { |
|
735 propertyName = name.substring(2); |
|
736 } |
|
737 if ((propertyName == null) || propertyName.isEmpty()){ |
|
738 return ""; |
|
739 } |
|
740 return propertyName.substring(0, 1).toLowerCase() |
|
741 + propertyName.substring(1); |
|
742 } |
|
743 |
|
744 /** |
|
745 * In case of JavaFX mode on, filters out classes that are private, |
|
746 * package private or having the @treatAsPrivate annotation. Those are not |
|
747 * documented in JavaFX mode. |
|
748 * |
|
749 * @param classes array of classes to be filtered. |
|
750 * @param javafx set to true if in JavaFX mode. |
|
751 * @return list of filtered classes. |
|
752 */ |
|
753 public static ClassDoc[] filterOutPrivateClasses(final ClassDoc[] classes, |
|
754 boolean javafx) { |
|
755 if (!javafx) { |
|
756 return classes; |
|
757 } |
|
758 final List<ClassDoc> filteredOutClasses = |
|
759 new ArrayList<ClassDoc>(classes.length); |
|
760 for (ClassDoc classDoc : classes) { |
|
761 if (classDoc.isPrivate() || classDoc.isPackagePrivate()) { |
|
762 continue; |
|
763 } |
|
764 Tag[] aspTags = classDoc.tags("treatAsPrivate"); |
|
765 if (aspTags != null && aspTags.length > 0) { |
|
766 continue; |
|
767 } |
|
768 filteredOutClasses.add(classDoc); |
|
769 } |
|
770 |
|
771 return filteredOutClasses.toArray(new ClassDoc[0]); |
|
772 } |
|
773 |
|
774 /** |
725 * Test whether the given FieldDoc is one of the declaration annotation ElementTypes |
775 * Test whether the given FieldDoc is one of the declaration annotation ElementTypes |
726 * defined in Java 5. |
776 * defined in Java 5. |
727 * Instead of testing for one of the new enum constants added in Java 8, test for |
777 * Instead of testing for one of the new enum constants added in Java 8, test for |
728 * the old constants. This prevents bootstrapping problems. |
778 * the old constants. This prevents bootstrapping problems. |
729 * |
779 * |