57 private int currentConstructorIndex; |
57 private int currentConstructorIndex; |
58 |
58 |
59 /** |
59 /** |
60 * The class whose constructors are being documented. |
60 * The class whose constructors are being documented. |
61 */ |
61 */ |
62 private ClassDoc classDoc; |
62 private final ClassDoc classDoc; |
63 |
63 |
64 /** |
64 /** |
65 * The visible constructors for the given class. |
65 * The visible constructors for the given class. |
66 */ |
66 */ |
67 private VisibleMemberMap visibleMemberMap; |
67 private final VisibleMemberMap visibleMemberMap; |
68 |
68 |
69 /** |
69 /** |
70 * The writer to output the constructor documentation. |
70 * The writer to output the constructor documentation. |
71 */ |
71 */ |
72 private ConstructorWriter writer; |
72 private final ConstructorWriter writer; |
73 |
73 |
74 /** |
74 /** |
75 * The constructors being documented. |
75 * The constructors being documented. |
76 */ |
76 */ |
77 private List<ProgramElementDoc> constructors; |
77 private final List<ProgramElementDoc> constructors; |
78 |
78 |
79 /** |
79 /** |
80 * Construct a new ConstructorBuilder. |
80 * Construct a new ConstructorBuilder. |
81 * |
81 * |
82 * @param configuration the current configuration of the |
82 * @param context the build context. |
83 * doclet. |
|
84 */ |
|
85 private ConstructorBuilder(Configuration configuration) { |
|
86 super(configuration); |
|
87 } |
|
88 |
|
89 /** |
|
90 * Construct a new ConstructorBuilder. |
|
91 * |
|
92 * @param configuration the current configuration of the doclet. |
|
93 * @param classDoc the class whoses members are being documented. |
83 * @param classDoc the class whoses members are being documented. |
94 * @param writer the doclet specific writer. |
84 * @param writer the doclet specific writer. |
95 */ |
85 */ |
96 public static ConstructorBuilder getInstance( |
86 private ConstructorBuilder(Context context, |
97 Configuration configuration, |
|
98 ClassDoc classDoc, |
87 ClassDoc classDoc, |
99 ConstructorWriter writer) { |
88 ConstructorWriter writer) { |
100 ConstructorBuilder builder = new ConstructorBuilder(configuration); |
89 super(context); |
101 builder.classDoc = classDoc; |
90 this.classDoc = classDoc; |
102 builder.writer = writer; |
91 this.writer = writer; |
103 builder.visibleMemberMap = |
92 visibleMemberMap = |
104 new VisibleMemberMap( |
93 new VisibleMemberMap( |
105 classDoc, |
94 classDoc, |
106 VisibleMemberMap.CONSTRUCTORS, |
95 VisibleMemberMap.CONSTRUCTORS, |
107 configuration.nodeprecated); |
96 configuration.nodeprecated); |
108 builder.constructors = |
97 constructors = |
109 new ArrayList<ProgramElementDoc>(builder.visibleMemberMap.getMembersFor(classDoc)); |
98 new ArrayList<ProgramElementDoc>(visibleMemberMap.getMembersFor(classDoc)); |
110 for (int i = 0; i < builder.constructors.size(); i++) { |
99 for (int i = 0; i < constructors.size(); i++) { |
111 if (builder.constructors.get(i).isProtected() |
100 if (constructors.get(i).isProtected() |
112 || builder.constructors.get(i).isPrivate()) { |
101 || constructors.get(i).isPrivate()) { |
113 writer.setFoundNonPubConstructor(true); |
102 writer.setFoundNonPubConstructor(true); |
114 } |
103 } |
115 } |
104 } |
116 if (configuration.getMemberComparator() != null) { |
105 if (configuration.getMemberComparator() != null) { |
117 Collections.sort( |
106 Collections.sort(constructors,configuration.getMemberComparator()); |
118 builder.constructors, |
107 } |
119 configuration.getMemberComparator()); |
108 } |
120 } |
109 |
121 return builder; |
110 /** |
|
111 * Construct a new ConstructorBuilder. |
|
112 * |
|
113 * @param context the build context. |
|
114 * @param classDoc the class whoses members are being documented. |
|
115 * @param writer the doclet specific writer. |
|
116 */ |
|
117 public static ConstructorBuilder getInstance(Context context, |
|
118 ClassDoc classDoc, ConstructorWriter writer) { |
|
119 return new ConstructorBuilder(context, classDoc, writer); |
122 } |
120 } |
123 |
121 |
124 /** |
122 /** |
125 * {@inheritDoc} |
123 * {@inheritDoc} |
126 */ |
124 */ |