@@ -143,7 +143,6 @@ public void generate() throws IOException
143
143
{
144
144
final StringBuilder sb = new StringBuilder ();
145
145
146
- // Initialize the imports
147
146
imports = new TreeSet <>();
148
147
this .imports .add ("io" );
149
148
@@ -1091,15 +1090,17 @@ private int generatePropertyEncodeDecode(
1091
1090
"\t if err := %1$s.%2$s.Encode(_m, _w); err != nil {\n " +
1092
1091
"\t \t return err\n " +
1093
1092
"\t }\n " ,
1094
- varName , propertyName ));
1093
+ varName ,
1094
+ propertyName ));
1095
1095
1096
1096
decode .append (String .format (
1097
1097
"\t if %1$s.%2$sInActingVersion(actingVersion) {\n " +
1098
1098
"\t \t if err := %1$s.%2$s.Decode(_m, _r, actingVersion); err != nil {\n " +
1099
1099
"\t \t \t return err\n " +
1100
1100
"\t \t }\n " +
1101
1101
"\t }\n " ,
1102
- varName , propertyName ));
1102
+ varName ,
1103
+ propertyName ));
1103
1104
1104
1105
return token .encodedLength () + gap ;
1105
1106
}
@@ -1354,17 +1355,14 @@ private void generateVarDataDescriptors(
1354
1355
final String characterEncoding ,
1355
1356
final Integer lengthOfLengthField )
1356
1357
{
1357
- final char varName = Character .toLowerCase (typeName .charAt (0 ));
1358
-
1359
1358
generateSinceActingDeprecated (sb , typeName , propertyName , token );
1360
1359
sb .append (String .format (
1361
- "\n func (%2 $s) %3 $sCharacterEncoding() string {\n " +
1360
+ "\n func (%1 $s) %2 $sCharacterEncoding() string {\n " +
1362
1361
"\t return \" %4$s\" \n " +
1363
1362
"}\n " +
1364
- "\n func (%2 $s) %3 $sHeaderLength() uint64 {\n " +
1365
- "\t return %5 $s\n " +
1363
+ "\n func (%1 $s) %2 $sHeaderLength() uint64 {\n " +
1364
+ "\t return %4 $s\n " +
1366
1365
"}\n " ,
1367
- varName ,
1368
1366
typeName ,
1369
1367
propertyName ,
1370
1368
characterEncoding ,
@@ -1375,12 +1373,10 @@ private void generateChoiceSet(final List<Token> tokens) throws IOException
1375
1373
{
1376
1374
final Token choiceToken = tokens .get (0 );
1377
1375
final String choiceName = formatTypeName (choiceToken .applicableTypeName ());
1378
- final char varName = Character .toLowerCase (choiceName .charAt (0 ));
1379
1376
final StringBuilder sb = new StringBuilder ();
1380
1377
1381
1378
try (Writer out = outputManager .createOutput (choiceName ))
1382
1379
{
1383
- // Initialize the imports
1384
1380
imports = new TreeSet <>();
1385
1381
imports .add ("io" );
1386
1382
@@ -1394,10 +1390,9 @@ private void generateChoiceSet(final List<Token> tokens) throws IOException
1394
1390
1395
1391
// EncodedLength
1396
1392
sb .append (String .format (
1397
- "\n func (%2 $s) EncodedLength() int64 {\n " +
1398
- "\t return %3 $s\n " +
1393
+ "\n func (%1 $s) EncodedLength() int64 {\n " +
1394
+ "\t return %2 $s\n " +
1399
1395
"}\n " ,
1400
- varName ,
1401
1396
choiceName ,
1402
1397
choiceToken .encodedLength ()));
1403
1398
@@ -1414,13 +1409,11 @@ private void generateEnum(final List<Token> tokens) throws IOException
1414
1409
{
1415
1410
final Token enumToken = tokens .get (0 );
1416
1411
final String enumName = formatTypeName (tokens .get (0 ).applicableTypeName ());
1417
- final char varName = Character .toLowerCase (enumName .charAt (0 ));
1418
1412
1419
1413
final StringBuilder sb = new StringBuilder ();
1420
1414
1421
1415
try (Writer out = outputManager .createOutput (enumName ))
1422
1416
{
1423
- // Initialize the imports
1424
1417
imports = new TreeSet <>();
1425
1418
imports .add ("io" );
1426
1419
@@ -1435,10 +1428,9 @@ private void generateEnum(final List<Token> tokens) throws IOException
1435
1428
1436
1429
// EncodedLength
1437
1430
sb .append (String .format (
1438
- "\n func (*%2 $sEnum) EncodedLength() int64 {\n " +
1439
- "\t return %3 $s\n " +
1431
+ "\n func (*%1 $sEnum) EncodedLength() int64 {\n " +
1432
+ "\t return %2 $s\n " +
1440
1433
"}\n " ,
1441
- varName ,
1442
1434
enumName ,
1443
1435
enumToken .encodedLength ()));
1444
1436
@@ -1461,7 +1453,6 @@ private void generateComposite(
1461
1453
1462
1454
try (Writer out = outputManager .createOutput (compositeName ))
1463
1455
{
1464
- // Initialize the imports
1465
1456
imports = new TreeSet <>();
1466
1457
imports .add ("io" );
1467
1458
@@ -1502,7 +1493,8 @@ private void generateEnumDecls(
1502
1493
sb .append (String .format (
1503
1494
"type %1$sEnum %2$s\n " +
1504
1495
"type %1$sValues struct {\n " ,
1505
- enumName , golangType ));
1496
+ enumName ,
1497
+ golangType ));
1506
1498
1507
1499
for (final Token token : tokens )
1508
1500
{
@@ -1822,32 +1814,29 @@ private void generateMinMaxNull(
1822
1814
1823
1815
// MinValue
1824
1816
sb .append (String .format (
1825
- "\n func (*%2 $s) %3 $sMinValue() %4 $s {\n " +
1826
- "\t return %5 $s\n " +
1817
+ "\n func (*%1 $s) %2 $sMinValue() %3 $s {\n " +
1818
+ "\t return %4 $s\n " +
1827
1819
"}\n " ,
1828
- Character .toLowerCase (typeName .charAt (0 )),
1829
1820
typeName ,
1830
1821
propertyName ,
1831
1822
golangTypeName ,
1832
1823
minValueString ));
1833
1824
1834
1825
// MaxValue
1835
1826
sb .append (String .format (
1836
- "\n func (*%2 $s) %3 $sMaxValue() %4 $s {\n " +
1837
- "\t return %5 $s\n " +
1827
+ "\n func (*%1 $s) %1 $sMaxValue() %3 $s {\n " +
1828
+ "\t return %4 $s\n " +
1838
1829
"}\n " ,
1839
- Character .toLowerCase (typeName .charAt (0 )),
1840
1830
typeName ,
1841
1831
propertyName ,
1842
1832
golangTypeName ,
1843
1833
maxValueString ));
1844
1834
1845
1835
// NullValue
1846
1836
sb .append (String .format (
1847
- "\n func (*%2 $s) %3 $sNullValue() %4 $s {\n " +
1848
- "\t return %5 $s\n " +
1837
+ "\n func (*%1 $s) %2 $sNullValue() %3 $s {\n " +
1838
+ "\t return %4 $s\n " +
1849
1839
"}\n " ,
1850
- Character .toLowerCase (typeName .charAt (0 )),
1851
1840
typeName ,
1852
1841
propertyName ,
1853
1842
golangTypeName ,
@@ -1880,10 +1869,9 @@ private void generateId(
1880
1869
final Token token )
1881
1870
{
1882
1871
sb .append (String .format (
1883
- "\n func (*%2 $s) %3 $sId() uint16 {\n " +
1884
- "\t return %4 $s\n " +
1872
+ "\n func (*%1 $s) %2 $sId() uint16 {\n " +
1873
+ "\t return %3 $s\n " +
1885
1874
"}\n " ,
1886
- Character .toLowerCase (typeName .charAt (0 )),
1887
1875
typeName ,
1888
1876
propertyName ,
1889
1877
token .id ()));
@@ -2009,10 +1997,9 @@ private void generateEncodedLength(
2009
1997
final int size )
2010
1998
{
2011
1999
sb .append (String .format (
2012
- "\n func (*%2 $s) EncodedLength() int64 {\n " +
2013
- "\t return %3 $s\n " +
2000
+ "\n func (*%1 $s) EncodedLength() int64 {\n " +
2001
+ "\t return %2 $s\n " +
2014
2002
"}\n " ,
2015
- Character .toLowerCase (typeName .charAt (0 )),
2016
2003
typeName ,
2017
2004
size ));
2018
2005
}
@@ -2032,22 +2019,21 @@ private void generateMessageCode(
2032
2019
generateEncodeDecode (sb , typeName , tokens , true , true );
2033
2020
2034
2021
sb .append (String .format (
2035
- "\n func (*%2 $s) SbeBlockLength() (blockLength %3 $s) {\n " +
2036
- "\t return %4 $s\n " +
2022
+ "\n func (*%1 $s) SbeBlockLength() (blockLength %2 $s) {\n " +
2023
+ "\t return %3 $s\n " +
2037
2024
"}\n " +
2038
- "\n func (*%2 $s) SbeTemplateId() (templateId %5 $s) {\n " +
2025
+ "\n func (*%1 $s) SbeTemplateId() (templateId %4 $s) {\n " +
2039
2026
"\t return %6$s\n " +
2040
2027
"}\n " +
2041
- "\n func (*%2 $s) SbeSchemaId() (schemaId %7 $s) {\n " +
2042
- "\t return %8 $s\n " +
2028
+ "\n func (*1 $s) SbeSchemaId() (schemaId %6 $s) {\n " +
2029
+ "\t return %7 $s\n " +
2043
2030
"}\n " +
2044
- "\n func (*%2 $s) SbeSchemaVersion() (schemaVersion %9 $s) {\n " +
2045
- "\t return %10 $s\n " +
2031
+ "\n func (*%1 $s) SbeSchemaVersion() (schemaVersion %8 $s) {\n " +
2032
+ "\t return %9 $s\n " +
2046
2033
"}\n " +
2047
- "\n func (*%2 $s) SbeSemanticType() (semanticType []byte) {\n " +
2048
- "\t return []byte(\" %11 $s\" )\n " +
2034
+ "\n func (*%1 $s) SbeSemanticType() (semanticType []byte) {\n " +
2035
+ "\t return []byte(\" %10 $s\" )\n " +
2049
2036
"}\n " ,
2050
- Character .toLowerCase (typeName .charAt (0 )),
2051
2037
typeName ,
2052
2038
blockLengthType ,
2053
2039
generateLiteral (ir .headerStructure ().blockLengthType (), Integer .toString (token .encodedLength ())),
@@ -2068,13 +2054,12 @@ private void generateExtensibilityMethods(
2068
2054
final Token token )
2069
2055
{
2070
2056
sb .append (String .format (
2071
- "\n func (*%2 $s) SbeBlockLength() (blockLength uint) {\n " +
2072
- "\t return %3 $s\n " +
2057
+ "\n func (*%1 $s) SbeBlockLength() (blockLength uint) {\n " +
2058
+ "\t return %2 $s\n " +
2073
2059
"}\n " +
2074
- "\n func (*%2 $s) SbeSchemaVersion() (schemaVersion %4 $s) {\n " +
2075
- "\t return %5 $s\n " +
2060
+ "\n func (*%1 $s) SbeSchemaVersion() (schemaVersion %3 $s) {\n " +
2061
+ "\t return %4 $s\n " +
2076
2062
"}\n " ,
2077
- Character .toLowerCase (typeName .charAt (0 )),
2078
2063
typeName ,
2079
2064
generateLiteral (ir .headerStructure ().blockLengthType (), Integer .toString (token .encodedLength ())),
2080
2065
golangTypeName (ir .headerStructure ().schemaVersionType ()),
@@ -2133,22 +2118,20 @@ private static void generateFieldMetaAttributeMethod(
2133
2118
final String presence = encoding .presence () == null ? "" : encoding .presence ().toString ().toLowerCase ();
2134
2119
2135
2120
sb .append (String .format (
2136
- "\n func (*%2 $s) %3$sMetaAttribute(meta int) string {\n " +
2121
+ "\n func (*%1 $s) %3$sMetaAttribute(meta int) string {\n " +
2137
2122
"\t switch meta {\n " +
2138
2123
"\t case 1:\n " +
2139
- "\t \t return \" %4 $s\" \n " +
2124
+ "\t \t return \" %2 $s\" \n " +
2140
2125
"\t case 2:\n " +
2141
- "\t \t return \" %5 $s\" \n " +
2126
+ "\t \t return \" %3 $s\" \n " +
2142
2127
"\t case 3:\n " +
2143
- "\t \t return \" %6 $s\" \n " +
2128
+ "\t \t return \" %4 $s\" \n " +
2144
2129
"\t case 4:\n " +
2145
- "\t \t return \" %7 $s\" \n " +
2130
+ "\t \t return \" %5 $s\" \n " +
2146
2131
"\t }\n " +
2147
2132
"\t return \" \" \n " +
2148
2133
"}\n " ,
2149
- Character .toLowerCase (containingTypeName .charAt (0 )),
2150
2134
containingTypeName ,
2151
- toUpperFirstChar (token .name ()),
2152
2135
epoch ,
2153
2136
timeUnit ,
2154
2137
semanticType ,
0 commit comments