langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/BuilderFactory.java
changeset 40587 1c355ea550ed
parent 36526 3b41f1c69604
child 45417 f7479ee8de69
equal deleted inserted replaced
40519:e17429a7e843 40587:1c355ea550ed
    81 
    81 
    82     /**
    82     /**
    83      * Return the builder that builds the constant summary.
    83      * Return the builder that builds the constant summary.
    84      * @return the builder that builds the constant summary.
    84      * @return the builder that builds the constant summary.
    85      */
    85      */
    86     public AbstractBuilder getConstantsSummaryBuilder() throws Exception {
    86     public AbstractBuilder getConstantsSummaryBuilder() {
    87         return ConstantsSummaryBuilder.getInstance(context,
    87         return ConstantsSummaryBuilder.getInstance(context,
    88             writerFactory.getConstantsSummaryWriter());
    88             writerFactory.getConstantsSummaryWriter());
    89     }
    89     }
    90 
    90 
    91     /**
    91     /**
    95      * @param prevPkg the previous package being documented.
    95      * @param prevPkg the previous package being documented.
    96      * @param nextPkg the next package being documented.
    96      * @param nextPkg the next package being documented.
    97      * @return the builder that builds the constant summary.
    97      * @return the builder that builds the constant summary.
    98      */
    98      */
    99     public AbstractBuilder getPackageSummaryBuilder(PackageElement pkg, PackageElement prevPkg,
    99     public AbstractBuilder getPackageSummaryBuilder(PackageElement pkg, PackageElement prevPkg,
   100             PackageElement nextPkg) throws Exception {
   100             PackageElement nextPkg) {
   101         return PackageSummaryBuilder.getInstance(context, pkg,
   101         return PackageSummaryBuilder.getInstance(context, pkg,
   102             writerFactory.getPackageSummaryWriter(pkg, prevPkg, nextPkg));
   102             writerFactory.getPackageSummaryWriter(pkg, prevPkg, nextPkg));
   103     }
   103     }
   104 
   104 
   105     /**
   105     /**
   109      * @param prevModule the previous module being documented.
   109      * @param prevModule the previous module being documented.
   110      * @param nextModule the next module being documented.
   110      * @param nextModule the next module being documented.
   111      * @return the builder that builds the module summary.
   111      * @return the builder that builds the module summary.
   112      */
   112      */
   113     public AbstractBuilder getModuleSummaryBuilder(ModuleElement mdle, ModuleElement prevModule,
   113     public AbstractBuilder getModuleSummaryBuilder(ModuleElement mdle, ModuleElement prevModule,
   114             ModuleElement nextModule) throws Exception {
   114             ModuleElement nextModule) {
   115         return ModuleSummaryBuilder.getInstance(context, mdle,
   115         return ModuleSummaryBuilder.getInstance(context, mdle,
   116             writerFactory.getModuleSummaryWriter(mdle, prevModule, nextModule));
   116             writerFactory.getModuleSummaryWriter(mdle, prevModule, nextModule));
   117     }
   117     }
   118 
   118 
   119     /**
   119     /**
   125      * @param classTree the class tree.
   125      * @param classTree the class tree.
   126      * @return the writer for the class.  Return null if this
   126      * @return the writer for the class.  Return null if this
   127      * writer is not supported by the doclet.
   127      * writer is not supported by the doclet.
   128      */
   128      */
   129     public AbstractBuilder getClassBuilder(TypeElement typeElement,
   129     public AbstractBuilder getClassBuilder(TypeElement typeElement,
   130             TypeElement prevClass, TypeElement nextClass, ClassTree classTree)
   130             TypeElement prevClass, TypeElement nextClass, ClassTree classTree) {
   131             throws Exception {
       
   132         return ClassBuilder.getInstance(context, typeElement,
   131         return ClassBuilder.getInstance(context, typeElement,
   133             writerFactory.getClassWriter(typeElement, prevClass, nextClass, classTree));
   132             writerFactory.getClassWriter(typeElement, prevClass, nextClass, classTree));
   134     }
   133     }
   135 
   134 
   136     /**
   135     /**
   141      * @param nextType the next type being documented.
   140      * @param nextType the next type being documented.
   142      * @return the writer for the annotation type.  Return null if this
   141      * @return the writer for the annotation type.  Return null if this
   143      * writer is not supported by the doclet.
   142      * writer is not supported by the doclet.
   144      */
   143      */
   145     public AbstractBuilder getAnnotationTypeBuilder(
   144     public AbstractBuilder getAnnotationTypeBuilder(
   146         TypeElement annotationType, TypeMirror prevType, TypeMirror nextType)
   145         TypeElement annotationType, TypeMirror prevType, TypeMirror nextType) {
   147             throws Exception {
       
   148         return AnnotationTypeBuilder.getInstance(context, annotationType,
   146         return AnnotationTypeBuilder.getInstance(context, annotationType,
   149             writerFactory.getAnnotationTypeWriter(annotationType, prevType, nextType));
   147             writerFactory.getAnnotationTypeWriter(annotationType, prevType, nextType));
   150     }
   148     }
   151 
   149 
   152     /**
   150     /**
   153      * Return an instance of the method builder for the given class.
   151      * Return an instance of the method builder for the given class.
   154      *
   152      *
   155      * @return an instance of the method builder for the given class.
   153      * @return an instance of the method builder for the given class.
   156      */
   154      */
   157     public AbstractBuilder getMethodBuilder(ClassWriter classWriter)
   155     public AbstractBuilder getMethodBuilder(ClassWriter classWriter) {
   158            throws Exception {
       
   159         return MethodBuilder.getInstance(context, classWriter.getTypeElement(),
   156         return MethodBuilder.getInstance(context, classWriter.getTypeElement(),
   160             writerFactory.getMethodWriter(classWriter));
   157             writerFactory.getMethodWriter(classWriter));
   161     }
   158     }
   162 
   159 
   163     /**
   160     /**
   166      *
   163      *
   167      * @return an instance of the annotation type field builder for the given
   164      * @return an instance of the annotation type field builder for the given
   168      *         annotation type.
   165      *         annotation type.
   169      */
   166      */
   170     public AbstractBuilder getAnnotationTypeFieldsBuilder(
   167     public AbstractBuilder getAnnotationTypeFieldsBuilder(
   171             AnnotationTypeWriter annotationTypeWriter)
   168             AnnotationTypeWriter annotationTypeWriter) {
   172     throws Exception {
       
   173         return AnnotationTypeFieldBuilder.getInstance(context,
   169         return AnnotationTypeFieldBuilder.getInstance(context,
   174                 annotationTypeWriter.getAnnotationTypeElement(),
   170                 annotationTypeWriter.getAnnotationTypeElement(),
   175                 writerFactory.getAnnotationTypeFieldWriter(annotationTypeWriter));
   171                 writerFactory.getAnnotationTypeFieldWriter(annotationTypeWriter));
   176     }
   172     }
   177 
   173 
   181      *
   177      *
   182      * @return an instance of the annotation type member builder for the given
   178      * @return an instance of the annotation type member builder for the given
   183      *         annotation type.
   179      *         annotation type.
   184      */
   180      */
   185     public AbstractBuilder getAnnotationTypeOptionalMemberBuilder(
   181     public AbstractBuilder getAnnotationTypeOptionalMemberBuilder(
   186             AnnotationTypeWriter annotationTypeWriter)
   182             AnnotationTypeWriter annotationTypeWriter) {
   187     throws Exception {
       
   188         return AnnotationTypeOptionalMemberBuilder.getInstance(context,
   183         return AnnotationTypeOptionalMemberBuilder.getInstance(context,
   189             annotationTypeWriter.getAnnotationTypeElement(),
   184             annotationTypeWriter.getAnnotationTypeElement(),
   190             writerFactory.getAnnotationTypeOptionalMemberWriter(annotationTypeWriter));
   185             writerFactory.getAnnotationTypeOptionalMemberWriter(annotationTypeWriter));
   191     }
   186     }
   192 
   187 
   196      *
   191      *
   197      * @return an instance of the annotation type member builder for the given
   192      * @return an instance of the annotation type member builder for the given
   198      *         annotation type.
   193      *         annotation type.
   199      */
   194      */
   200     public AbstractBuilder getAnnotationTypeRequiredMemberBuilder(
   195     public AbstractBuilder getAnnotationTypeRequiredMemberBuilder(
   201             AnnotationTypeWriter annotationTypeWriter)
   196             AnnotationTypeWriter annotationTypeWriter) {
   202     throws Exception {
       
   203         return AnnotationTypeRequiredMemberBuilder.getInstance(context,
   197         return AnnotationTypeRequiredMemberBuilder.getInstance(context,
   204             annotationTypeWriter.getAnnotationTypeElement(),
   198             annotationTypeWriter.getAnnotationTypeElement(),
   205             writerFactory.getAnnotationTypeRequiredMemberWriter(annotationTypeWriter));
   199             writerFactory.getAnnotationTypeRequiredMemberWriter(annotationTypeWriter));
   206     }
   200     }
   207 
   201 
   208     /**
   202     /**
   209      * Return an instance of the enum constants builder for the given class.
   203      * Return an instance of the enum constants builder for the given class.
   210      *
   204      *
   211      * @return an instance of the enum constants builder for the given class.
   205      * @return an instance of the enum constants builder for the given class.
   212      */
   206      */
   213     public AbstractBuilder getEnumConstantsBuilder(ClassWriter classWriter)
   207     public AbstractBuilder getEnumConstantsBuilder(ClassWriter classWriter) {
   214             throws Exception {
       
   215         return EnumConstantBuilder.getInstance(context, classWriter.getTypeElement(),
   208         return EnumConstantBuilder.getInstance(context, classWriter.getTypeElement(),
   216                 writerFactory.getEnumConstantWriter(classWriter));
   209                 writerFactory.getEnumConstantWriter(classWriter));
   217     }
   210     }
   218 
   211 
   219     /**
   212     /**
   220      * Return an instance of the field builder for the given class.
   213      * Return an instance of the field builder for the given class.
   221      *
   214      *
   222      * @return an instance of the field builder for the given class.
   215      * @return an instance of the field builder for the given class.
   223      */
   216      */
   224     public AbstractBuilder getFieldBuilder(ClassWriter classWriter) throws Exception {
   217     public AbstractBuilder getFieldBuilder(ClassWriter classWriter) {
   225         return FieldBuilder.getInstance(context, classWriter.getTypeElement(),
   218         return FieldBuilder.getInstance(context, classWriter.getTypeElement(),
   226             writerFactory.getFieldWriter(classWriter));
   219             writerFactory.getFieldWriter(classWriter));
   227     }
   220     }
   228 
   221 
   229     /**
   222     /**
   230      * Return an instance of the property builder for the given class.
   223      * Return an instance of the property builder for the given class.
   231      *
   224      *
   232      * @return an instance of the field builder for the given class.
   225      * @return an instance of the field builder for the given class.
   233      */
   226      */
   234     public AbstractBuilder getPropertyBuilder(ClassWriter classWriter) throws Exception {
   227     public AbstractBuilder getPropertyBuilder(ClassWriter classWriter) {
   235         final PropertyWriter propertyWriter =
   228         final PropertyWriter propertyWriter =
   236                 writerFactory.getPropertyWriter(classWriter);
   229                 writerFactory.getPropertyWriter(classWriter);
   237         return PropertyBuilder.getInstance(context,
   230         return PropertyBuilder.getInstance(context,
   238                                            classWriter.getTypeElement(),
   231                                            classWriter.getTypeElement(),
   239                                            propertyWriter);
   232                                            propertyWriter);
   242     /**
   235     /**
   243      * Return an instance of the constructor builder for the given class.
   236      * Return an instance of the constructor builder for the given class.
   244      *
   237      *
   245      * @return an instance of the constructor builder for the given class.
   238      * @return an instance of the constructor builder for the given class.
   246      */
   239      */
   247     public AbstractBuilder getConstructorBuilder(ClassWriter classWriter)
   240     public AbstractBuilder getConstructorBuilder(ClassWriter classWriter) {
   248             throws Exception {
       
   249         return ConstructorBuilder.getInstance(context, classWriter.getTypeElement(),
   241         return ConstructorBuilder.getInstance(context, classWriter.getTypeElement(),
   250             writerFactory.getConstructorWriter(classWriter));
   242             writerFactory.getConstructorWriter(classWriter));
   251     }
   243     }
   252 
   244 
   253     /**
   245     /**
   254      * Return an instance of the member summary builder for the given class.
   246      * Return an instance of the member summary builder for the given class.
   255      *
   247      *
   256      * @return an instance of the member summary builder for the given class.
   248      * @return an instance of the member summary builder for the given class.
   257      */
   249      */
   258     public AbstractBuilder getMemberSummaryBuilder(ClassWriter classWriter)
   250     public AbstractBuilder getMemberSummaryBuilder(ClassWriter classWriter) {
   259             throws Exception {
       
   260         return MemberSummaryBuilder.getInstance(classWriter, context);
   251         return MemberSummaryBuilder.getInstance(classWriter, context);
   261     }
   252     }
   262 
   253 
   263     /**
   254     /**
   264      * Return an instance of the member summary builder for the given annotation
   255      * Return an instance of the member summary builder for the given annotation
   265      * type.
   256      * type.
   266      *
   257      *
   267      * @return an instance of the member summary builder for the given
   258      * @return an instance of the member summary builder for the given
   268      *         annotation type.
   259      *         annotation type.
   269      */
   260      */
   270     public AbstractBuilder getMemberSummaryBuilder(
   261     public AbstractBuilder getMemberSummaryBuilder(AnnotationTypeWriter annotationTypeWriter) {
   271             AnnotationTypeWriter annotationTypeWriter)
       
   272     throws Exception {
       
   273         return MemberSummaryBuilder.getInstance(annotationTypeWriter, context);
   262         return MemberSummaryBuilder.getInstance(annotationTypeWriter, context);
   274     }
   263     }
   275 
   264 
   276     /**
   265     /**
   277      * Return the builder that builds the serialized form.
   266      * Return the builder that builds the serialized form.
   278      *
   267      *
   279      * @return the builder that builds the serialized form.
   268      * @return the builder that builds the serialized form.
   280      */
   269      */
   281     public AbstractBuilder getSerializedFormBuilder()
   270     public AbstractBuilder getSerializedFormBuilder() {
   282             throws Exception {
       
   283         return SerializedFormBuilder.getInstance(context);
   271         return SerializedFormBuilder.getInstance(context);
   284     }
   272     }
   285 }
   273 }