Skip to content

Commit f91534a

Browse files
committed
[Java] Naming and javadoc.
1 parent 191c5d9 commit f91534a

File tree

7 files changed

+35
-23
lines changed

7 files changed

+35
-23
lines changed

sbe-tool/src/main/java/uk/co/real_logic/sbe/PrimitiveValue.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,13 @@
2424
import static java.nio.charset.StandardCharsets.US_ASCII;
2525

2626
/**
27-
* Class used to encapsulate values for primitives. Used for nullValue, minValue, maxValue, and constants
27+
* Class used to encapsulate values for primitives. Used for nullValue, minValue, maxValue, and constants.
2828
*/
2929
public class PrimitiveValue
3030
{
31+
/**
32+
* Representation type used for the stored value.
33+
*/
3134
public enum Representation
3235
{
3336
/**

sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/java/JavaGenerator.java

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3160,7 +3160,7 @@ private CharSequence generateCompositeDecoderDisplay(final List<Token> tokens)
31603160
append(sb, INDENT, " return builder;");
31613161
append(sb, INDENT, " }");
31623162
sb.append('\n');
3163-
Separators.BEGIN_COMPOSITE.appendToGeneratedBuilder(sb, INDENT + INDENT, "builder");
3163+
Separator.BEGIN_COMPOSITE.appendToGeneratedBuilder(sb, INDENT + INDENT, "builder");
31643164

31653165
int lengthBeforeLastGeneratedSeparator = -1;
31663166

@@ -3177,7 +3177,7 @@ private CharSequence generateCompositeDecoderDisplay(final List<Token> tokens)
31773177
sb.setLength(lengthBeforeLastGeneratedSeparator);
31783178
}
31793179

3180-
Separators.END_COMPOSITE.appendToGeneratedBuilder(sb, INDENT + INDENT, "builder");
3180+
Separator.END_COMPOSITE.appendToGeneratedBuilder(sb, INDENT + INDENT, "builder");
31813181
sb.append('\n');
31823182
append(sb, INDENT, " return builder;");
31833183
append(sb, INDENT, "}");
@@ -3194,7 +3194,7 @@ private CharSequence generateChoiceDisplay(final List<Token> tokens)
31943194
sb.append('\n');
31953195
append(sb, indent, "public StringBuilder appendTo(final StringBuilder builder)");
31963196
append(sb, indent, "{");
3197-
Separators.BEGIN_SET.appendToGeneratedBuilder(sb, indent + INDENT, "builder");
3197+
Separator.BEGIN_SET.appendToGeneratedBuilder(sb, indent + INDENT, "builder");
31983198
append(sb, indent, " boolean atLeastOne = false;");
31993199

32003200
for (final Token token : tokens)
@@ -3206,15 +3206,15 @@ private CharSequence generateChoiceDisplay(final List<Token> tokens)
32063206
append(sb, indent, " {");
32073207
append(sb, indent, " if (atLeastOne)");
32083208
append(sb, indent, " {");
3209-
Separators.ENTRY.appendToGeneratedBuilder(sb, indent + INDENT + INDENT + INDENT, "builder");
3209+
Separator.ENTRY.appendToGeneratedBuilder(sb, indent + INDENT + INDENT + INDENT, "builder");
32103210
append(sb, indent, " }");
32113211
append(sb, indent, " builder.append(\"" + choiceName + "\");");
32123212
append(sb, indent, " atLeastOne = true;");
32133213
append(sb, indent, " }");
32143214
}
32153215
}
32163216

3217-
Separators.END_SET.appendToGeneratedBuilder(sb, indent + INDENT, "builder");
3217+
Separator.END_SET.appendToGeneratedBuilder(sb, indent + INDENT, "builder");
32183218
sb.append('\n');
32193219
append(sb, indent, " return builder;");
32203220
append(sb, indent, "}");
@@ -3286,9 +3286,9 @@ private void appendGroupInstanceDecoderDisplay(
32863286
append(sb, indent, " return builder;");
32873287
append(sb, indent, " }");
32883288
sb.append('\n');
3289-
Separators.BEGIN_COMPOSITE.appendToGeneratedBuilder(sb, indent + INDENT, "builder");
3289+
Separator.BEGIN_COMPOSITE.appendToGeneratedBuilder(sb, indent + INDENT, "builder");
32903290
appendDecoderDisplay(sb, fields, groups, varData, indent + INDENT);
3291-
Separators.END_COMPOSITE.appendToGeneratedBuilder(sb, indent + INDENT, "builder");
3291+
Separator.END_COMPOSITE.appendToGeneratedBuilder(sb, indent + INDENT, "builder");
32923292
sb.append('\n');
32933293
append(sb, indent, " return builder;");
32943294
append(sb, indent, "}");
@@ -3332,21 +3332,21 @@ private void appendDecoderDisplay(
33323332
final String groupDecoderName = decoderName(groupToken.name());
33333333

33343334
append(
3335-
sb, indent, "builder.append(\"" + groupName + Separators.KEY_VALUE + Separators.BEGIN_GROUP + "\");");
3335+
sb, indent, "builder.append(\"" + groupName + Separator.KEY_VALUE + Separator.BEGIN_GROUP + "\");");
33363336
append(sb, indent, groupDecoderName + " " + groupName + " = " + groupName + "();");
33373337
append(sb, indent, "if (" + groupName + ".count() > 0)");
33383338
append(sb, indent, "{");
33393339
append(sb, indent, " while (" + groupName + ".hasNext())");
33403340
append(sb, indent, " {");
33413341
append(sb, indent, " " + groupName + ".next().appendTo(builder);");
3342-
Separators.ENTRY.appendToGeneratedBuilder(sb, indent + INDENT + INDENT, "builder");
3342+
Separator.ENTRY.appendToGeneratedBuilder(sb, indent + INDENT + INDENT, "builder");
33433343
append(sb, indent, " }");
33443344
append(sb, indent, " builder.setLength(builder.length() - 1);");
33453345
append(sb, indent, "}");
3346-
Separators.END_GROUP.appendToGeneratedBuilder(sb, indent, "builder");
3346+
Separator.END_GROUP.appendToGeneratedBuilder(sb, indent, "builder");
33473347

33483348
lengthBeforeLastGeneratedSeparator = sb.length();
3349-
Separators.FIELD.appendToGeneratedBuilder(sb, indent, "builder");
3349+
Separator.FIELD.appendToGeneratedBuilder(sb, indent, "builder");
33503350

33513351
i = findEndSignal(groups, i, Signal.END_GROUP, groupToken.name());
33523352
}
@@ -3361,7 +3361,7 @@ private void appendDecoderDisplay(
33613361

33623362
final String characterEncoding = varData.get(i + 3).encoding().characterEncoding();
33633363
final String varDataName = formatPropertyName(varDataToken.name());
3364-
append(sb, indent, "builder.append(\"" + varDataName + Separators.KEY_VALUE + "\");");
3364+
append(sb, indent, "builder.append(\"" + varDataName + Separator.KEY_VALUE + "\");");
33653365
if (null == characterEncoding)
33663366
{
33673367
final String name = Generators.toUpperFirstChar(varDataToken.name());
@@ -3382,7 +3382,7 @@ private void appendDecoderDisplay(
33823382
}
33833383

33843384
lengthBeforeLastGeneratedSeparator = sb.length();
3385-
Separators.FIELD.appendToGeneratedBuilder(sb, indent, "builder");
3385+
Separator.FIELD.appendToGeneratedBuilder(sb, indent, "builder");
33863386

33873387
i += varDataToken.componentTokenCount();
33883388
}
@@ -3401,7 +3401,7 @@ private int writeTokenDisplay(
34013401
return -1;
34023402
}
34033403

3404-
append(sb, indent, "builder.append(\"" + fieldName + Separators.KEY_VALUE + "\");");
3404+
append(sb, indent, "builder.append(\"" + fieldName + Separator.KEY_VALUE + "\");");
34053405

34063406
switch (typeToken.signal())
34073407
{
@@ -3418,17 +3418,17 @@ private int writeTokenDisplay(
34183418
}
34193419
else
34203420
{
3421-
Separators.BEGIN_ARRAY.appendToGeneratedBuilder(sb, indent, "builder");
3421+
Separator.BEGIN_ARRAY.appendToGeneratedBuilder(sb, indent, "builder");
34223422
append(sb, indent, "if (" + fieldName + "Length() > 0)");
34233423
append(sb, indent, "{");
34243424
append(sb, indent, " for (int i = 0; i < " + fieldName + "Length(); i++)");
34253425
append(sb, indent, " {");
34263426
append(sb, indent, " builder.append(" + fieldName + "(i));");
3427-
Separators.ENTRY.appendToGeneratedBuilder(sb, indent + INDENT + INDENT, "builder");
3427+
Separator.ENTRY.appendToGeneratedBuilder(sb, indent + INDENT + INDENT, "builder");
34283428
append(sb, indent, " }");
34293429
append(sb, indent, " builder.setLength(builder.length() - 1);");
34303430
append(sb, indent, "}");
3431-
Separators.END_ARRAY.appendToGeneratedBuilder(sb, indent, "builder");
3431+
Separator.END_ARRAY.appendToGeneratedBuilder(sb, indent, "builder");
34323432
}
34333433
}
34343434
else
@@ -3463,7 +3463,7 @@ private int writeTokenDisplay(
34633463
}
34643464

34653465
final int lengthBeforeFieldSeparator = sb.length();
3466-
Separators.FIELD.appendToGeneratedBuilder(sb, indent, "builder");
3466+
Separator.FIELD.appendToGeneratedBuilder(sb, indent, "builder");
34673467

34683468
return lengthBeforeFieldSeparator;
34693469
}

sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/java/JavaUtil.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,10 @@
3636
*/
3737
public class JavaUtil
3838
{
39-
public enum Separators
39+
/**
40+
* Separator symbols for {@link Object#toString()} implementations on codecs.
41+
*/
42+
public enum Separator
4043
{
4144
BEGIN_GROUP('['),
4245
END_GROUP(']'),
@@ -52,7 +55,7 @@ public enum Separators
5255

5356
public final char symbol;
5457

55-
Separators(final char symbol)
58+
Separator(final char symbol)
5659
{
5760
this.symbol = symbol;
5861
}

sbe-tool/src/main/java/uk/co/real_logic/sbe/ir/Token.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ public String toString()
352352
}
353353

354354
/**
355-
* Builder for Tokens which can simplify construction.
355+
* Builder for {@link Token} which can simplify construction.
356356
*/
357357
public static class Builder
358358
{

sbe-tool/src/main/java/uk/co/real_logic/sbe/xml/EnumType.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ public String toString()
237237
}
238238

239239
/**
240-
* Class to hold valid values for EnumType
240+
* Holder for valid values for and {@link EnumType}.
241241
*/
242242
public static class ValidValue
243243
{

sbe-tool/src/main/java/uk/co/real_logic/sbe/xml/Field.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,9 @@ private void validateValueRef(final Node node, final Map<String, Type> typeByNam
296296
}
297297
}
298298

299+
/**
300+
* Builder to make creation of {@link Field} easier.
301+
*/
299302
public static class Builder
300303
{
301304
private String name;

sbe-tool/src/main/java/uk/co/real_logic/sbe/xml/ParserOptions.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,9 @@ public static Builder builder()
112112
return new Builder();
113113
}
114114

115+
/**
116+
* Builder to make {@link ParserOptions} easier to create.
117+
*/
115118
public static class Builder
116119
{
117120
private boolean stopOnError;

0 commit comments

Comments
 (0)