Skip to content

Commit 86bfdb4

Browse files
committed
Add MissingJavadocMethod to checkstyle
Allow missing java doc for empty methods and constructors. - fix javadoc - simplify Marc21Encoder's non-arg constructor See #396.
1 parent 001b560 commit 86bfdb4

File tree

5 files changed

+183
-17
lines changed

5 files changed

+183
-17
lines changed

config/checkstyle/checkstyle.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,9 @@
8282
<module name="MethodTypeParameterName"/>
8383
<module name="MissingCtor"/>
8484
<module name="MissingDeprecated"/>
85+
<module name="MissingJavadocMethod">
86+
<property name="minLineCount" value="1"/>
87+
</module>
8588
<module name="MissingOverride"/>
8689
<module name="MissingSwitchDefault"/>
8790
<module name="ModifiedControlVariable"/>

metafacture-biblio/src/main/java/org/metafacture/biblio/iso2709/RecordBuilder.java

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,12 @@ public final class RecordBuilder {
5656
private AppendState appendState;
5757
private int fieldStart;
5858

59+
/**
60+
* Initializes the RecordBuilder based on a RecordFormat.
61+
*
62+
* @param recordFormat RecordFormat as base to configure the RecordBuilder
63+
* @see RecordFormat
64+
*/
5965
public RecordBuilder(final RecordFormat recordFormat) {
6066
Require.notNull(recordFormat);
6167
label = new LabelBuilder(recordFormat);
@@ -82,6 +88,13 @@ private char[] arrayOfNSpaceChars(final int count) {
8288
return chars;
8389
}
8490

91+
/**
92+
* Sets the charset of the FieldsBuilder.
93+
*
94+
* @param charset Charset used by the FieldsBuilder
95+
* @see FieldsBuilder
96+
* @see Charset
97+
*/
8598
public void setCharset(final Charset charset) {
8699
fields.setCharset(Require.notNull(charset));
87100
}
@@ -90,46 +103,101 @@ public Charset getCharset() {
90103
return fields.getCharset();
91104
}
92105

106+
/**
107+
* Sets the record status of the LabelBuilder.
108+
*
109+
* @param recordStatus 7 bit char record status
110+
* @see Iso2709Constants.RECORD_STATUS_POS
111+
* @see LabelBuilder
112+
*/
93113
public void setRecordStatus(final char recordStatus) {
94114
require7BitAscii(recordStatus);
95115
label.setRecordStatus(recordStatus);
96116
}
97117

118+
/**
119+
* Sets the impl codes in the LabelBuilder.
120+
*
121+
* @param implCodes char array of 7 bit impl codes
122+
* @see Iso2709Constants
123+
* @see LabelBuilder
124+
*/
98125
public void setImplCodes(final char[] implCodes) {
99126
Require.notNull(implCodes);
100127
Require.that(implCodes.length == Iso2709Constants.IMPL_CODES_LENGTH);
101128
require7BitAscii(implCodes);
102129
label.setImplCodes(implCodes);
103130
}
104131

132+
/**
133+
* Sets an impl code at a given position in the LabelBuilder.
134+
*
135+
* @param index index of the 7 bit impl code
136+
* @param implCode char of a 7 bit impl code
137+
* @see Iso2709Constants
138+
* @see LabelBuilder
139+
*/
105140
public void setImplCode(final int index, final char implCode) {
106141
Require.that(0 <= index && index < Iso2709Constants.IMPL_CODES_LENGTH);
107142
require7BitAscii(implCode);
108143
label.setImplCode(index, implCode);
109144
}
110145

146+
/**
147+
* Sets the system chars in the LabelBuilder.
148+
*
149+
* @param systemChars 7-bit char array to be set as system chars
150+
* @see Iso2709Constants
151+
* @see LabelBuilder
152+
*/
111153
public void setSystemChars(final char[] systemChars) {
112154
Require.notNull(systemChars);
113155
Require.that(systemChars.length == Iso2709Constants.SYSTEM_CHARS_LENGTH);
114156
require7BitAscii(systemChars);
115157
label.setSystemChars(systemChars);
116158
}
117159

160+
/**
161+
* Sets a system char at the given position in the LabelBuilder.
162+
*
163+
* @param systemChar 7-bit char to be set as the system char
164+
* @param index position of the system char
165+
* @see Iso2709Constants
166+
* @see LabelBuilder
167+
*/
118168
public void setSystemChar(final int index, final char systemChar) {
119169
Require.that(0 <= index && index < Iso2709Constants.SYSTEM_CHARS_LENGTH);
120170
require7BitAscii(systemChar);
121171
label.setSystemChar(index, systemChar);
122172
}
123173

174+
/**
175+
* Sets a reserved char in the LabelBuilder.
176+
*
177+
* @param reservedChar 7-bit char to be set as reserved char
178+
* @see Iso2709Constants
179+
* @see LabelBuilder
180+
*/
124181
public void setReservedChar(final char reservedChar) {
125182
require7BitAscii(reservedChar);
126183
label.setReservedChar(reservedChar);
127184
}
128185

186+
/**
187+
* Appends an identifier field.
188+
*
189+
* @param value String that is appended as an identfier field
190+
*/
129191
public void appendIdentifierField(final String value) {
130192
appendIdentifierField(defaultImplDefinedPart, value);
131193
}
132194

195+
/**
196+
* Appends an identifier field in dependency of the current impl defined part.
197+
*
198+
* @param currentImplDefinedPart char array of the current impl defined part
199+
* @param value String that is appended as an identfier field
200+
*/
133201
public void appendIdentifierField(final char[] currentImplDefinedPart, final String value) {
134202
requireNotInDataField();
135203
requireNotAppendingReferenceFields();
@@ -144,6 +212,14 @@ public void appendReferenceField(final char[] currentTag, final String value) {
144212
appendReferenceField(currentTag, defaultImplDefinedPart, value);
145213
}
146214

215+
/**
216+
* Appends a reference field in dependency of the current tag and of the
217+
* current impl defined part.
218+
*
219+
* @param currentTag char array of the current tag
220+
* @param currentImplDefinedPart char array of the current impl defined part
221+
* @param value String that is appended as a reference field
222+
*/
147223
public void appendReferenceField(final char[] currentTag, final char[] currentImplDefinedPart, final String value) {
148224
requireNotInDataField();
149225
requireNotAppendingDataFields();
@@ -181,6 +257,14 @@ public void startDataField(final char[] currentTag, final char[] indicators) {
181257
startDataField(currentTag, indicators, defaultImplDefinedPart);
182258
}
183259

260+
/**
261+
* Starts a data field in dependency of the current tag, indicators and of the
262+
* current impl defined part.
263+
*
264+
* @param currentTag char array of the current tag
265+
* @param indicators char array of the current indicators
266+
* @param currentImplDefinedPart char array of the current impl defined part
267+
*/
184268
public void startDataField(final char[] currentTag, final char[] indicators, final char[] currentImplDefinedPart) {
185269
requireNotInDataField();
186270
Require.notNull(currentTag);
@@ -208,6 +292,9 @@ private void copyArray(final char[] source, final char[] destination) {
208292
System.arraycopy(source, 0, destination, 0, destination.length);
209293
}
210294

295+
/**
296+
* Ends a data field.
297+
*/
211298
public void endDataField() {
212299
requireInDataField();
213300
final int fieldEnd = fields.endField();
@@ -221,12 +308,23 @@ public void endDataField() {
221308
}
222309
}
223310

311+
/**
312+
* Appends a subfield.
313+
*
314+
* @param value String of the to be appended subfield
315+
*/
224316
public void appendSubfield(final String value) {
225317
requireInDataField();
226318
Require.notNull(value);
227319
fields.appendSubfield(defaultIdentifier, value);
228320
}
229321

322+
/**
323+
* Appends a subfield in dependency of an identifier.
324+
*
325+
* @param identifier char array of an identifier
326+
* @param value String of the to be appended subfield
327+
*/
230328
public void appendSubfield(final char[] identifier, final String value) {
231329
requireInDataField();
232330
Require.notNull(identifier);
@@ -236,6 +334,11 @@ public void appendSubfield(final char[] identifier, final String value) {
236334
fields.appendSubfield(identifier, value);
237335
}
238336

337+
/**
338+
* Builds the record.
339+
*
340+
* @return byte array of the record
341+
*/
239342
public byte[] build() {
240343
requireNotInDataField();
241344
final int baseAddress = Iso2709Constants.RECORD_LABEL_LENGTH + directory.length();
@@ -286,6 +389,12 @@ private void require7BitAscii(final char charCode) {
286389
Require.that(charCode != Iso646Constants.INFORMATION_SEPARATOR_3);
287390
}
288391

392+
/**
393+
* Resets the label, directory and the fields. Sets the "append state" to "id
394+
* field".
395+
*
396+
* @see AppendState.ID_FIELD
397+
*/
289398
public void reset() {
290399
label.reset();
291400
directory.reset();

metafacture-biblio/src/main/java/org/metafacture/biblio/iso2709/RecordFormat.java

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,15 @@ public final class RecordFormat {
5151
private final int fieldStartLength;
5252
private final int implDefinedPartLength;
5353

54+
/**
55+
* Initializes the RecordFormat.
56+
*
57+
* @param indicatorLength the length of the indicator
58+
* @param identifierLength the length of the identifier
59+
* @param fieldLengthLength the length of the field
60+
* @param fieldStartLength the length of the indicator
61+
* @param implDefinedPartLength the length of the part
62+
*/
5463
public RecordFormat(final int indicatorLength, final int identifierLength,
5564
final int fieldLengthLength, final int fieldStartLength,
5665
final int implDefinedPartLength) {
@@ -61,6 +70,11 @@ public RecordFormat(final int indicatorLength, final int identifierLength,
6170
this.implDefinedPartLength = implDefinedPartLength;
6271
}
6372

73+
/**
74+
* Initializes a RecordFormat defined by a RecordFormat.
75+
*
76+
* @param source the RecordFormat
77+
*/
6478
public RecordFormat(final RecordFormat source) {
6579
Require.notNull(source);
6680

@@ -71,10 +85,21 @@ public RecordFormat(final RecordFormat source) {
7185
implDefinedPartLength = source.implDefinedPartLength;
7286
}
7387

88+
/**
89+
* Returns a new default Builder.
90+
*
91+
* @return Builder
92+
*/
7493
public static Builder create() {
7594
return new Builder();
7695
}
7796

97+
/**
98+
* Returns a new Builder created from a RecordFormat.
99+
*
100+
* @param source the RecordFormat
101+
* @return Builder
102+
*/
78103
public static Builder createFrom(final RecordFormat source) {
79104
return create()
80105
.withIndicatorLength(source.indicatorLength)
@@ -149,41 +174,76 @@ public static class Builder {
149174
Builder() {
150175
}
151176

177+
/**
178+
* Returns a new Builder with defined indicator length.
179+
*
180+
* @param currentIndicatorLength the length of the indicator
181+
* @return Builder
182+
*/
152183
public Builder withIndicatorLength(final int currentIndicatorLength) {
153184
Require.notNegative(currentIndicatorLength);
154185
Require.that(currentIndicatorLength < RADIX);
155186
indicatorLength = currentIndicatorLength;
156187
return this;
157188
}
158189

190+
/**
191+
* Returns a new Builder with defined identifier length.
192+
*
193+
* @param currentIdentifierLength the length of the identifier
194+
* @return Builder
195+
*/
159196
public Builder withIdentifierLength(final int currentIdentifierLength) {
160197
Require.notNegative(currentIdentifierLength);
161198
Require.that(currentIdentifierLength < RADIX);
162199
identifierLength = currentIdentifierLength;
163200
return this;
164201
}
165202

203+
/**
204+
* Returns a new Builder with defined field length.
205+
*
206+
* @param currentFieldLengthLength the length of the field
207+
* @return Builder
208+
*/
166209
public Builder withFieldLengthLength(final int currentFieldLengthLength) {
167210
Require.that(currentFieldLengthLength > 0);
168211
Require.that(currentFieldLengthLength < RADIX);
169212
fieldLengthLength = currentFieldLengthLength;
170213
return this;
171214
}
172215

216+
/**
217+
* Returns a new Builder with defined field start length.
218+
*
219+
* @param currentFieldStartLength the length of the field start
220+
* @return Builder
221+
*/
173222
public Builder withFieldStartLength(final int currentFieldStartLength) {
174223
Require.that(currentFieldStartLength > 0);
175224
Require.that(currentFieldStartLength < RADIX);
176225
fieldStartLength = currentFieldStartLength;
177226
return this;
178227
}
179228

229+
/**
230+
* Returns a new Builder with defined part length.
231+
*
232+
* @param currentImplDefinedPartLength the length of the part
233+
* @return Builder
234+
*/
180235
public Builder withImplDefinedPartLength(final int currentImplDefinedPartLength) {
181236
Require.notNegative(currentImplDefinedPartLength);
182237
Require.that(currentImplDefinedPartLength < RADIX);
183238
implDefinedPartLength = currentImplDefinedPartLength;
184239
return this;
185240
}
186241

242+
/**
243+
* Returns a new RecordFormat.
244+
*
245+
* @return RecordFormat
246+
*/
187247
public RecordFormat build() {
188248
return new RecordFormat(indicatorLength, identifierLength,
189249
fieldLengthLength, fieldStartLength, implDefinedPartLength);

metafacture-biblio/src/main/java/org/metafacture/biblio/marc21/Marc21Encoder.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,10 @@ public final class Marc21Encoder extends
8080

8181
private boolean generateIdField;
8282

83+
/**
84+
* Initializes the encoder with MARC 21 constants and charset.
85+
*
86+
*/
8387
public Marc21Encoder() {
8488
builder = new RecordBuilder(Marc21Constants.MARC21_FORMAT);
8589
builder.setCharset(Marc21Constants.MARC21_CHARSET);

0 commit comments

Comments
 (0)