Skip to content

Commit daa32ab

Browse files
committed
Changed generated Java subtypes methods to static
1 parent 021c634 commit daa32ab

File tree

2 files changed

+26
-26
lines changed

2 files changed

+26
-26
lines changed

compiler/extensions/java/freemarker/Subtype.java.ftl

+24-6
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,38 @@
77
</#if>
88
public final class ${name} implements zserio.runtime.ZserioSubtype
99
{
10-
@Override
11-
public String getBaseTypePackage()
10+
<#if withCodeComments>
11+
/**
12+
* Gets the package of the base type which is resolved from the subtype.
13+
*
14+
* @return The package of the base type or null if the base type is simple type.
15+
*/
16+
</#if>
17+
public static String getBaseTypePackage()
1218
{
1319
return <#if basePackageName?? && basePackageName != "">"${basePackageName}"<#else>null</#if>;
1420
}
1521

16-
@Override
17-
public String getBaseTypeName()
22+
<#if withCodeComments>
23+
/**
24+
* Gets the name of the base type which is resolved from the subtype.
25+
*
26+
* @return The name of the base type.
27+
*/
28+
</#if>
29+
public static String getBaseTypeName()
1830
{
1931
return "${baseTypeName}";
2032
}
2133

22-
@Override
23-
public Class<?> getBaseClass()
34+
<#if withCodeComments>
35+
/**
36+
* Gets the class of the base type which is resolved from the subtype.
37+
*
38+
* @return The class of the base type or the class of boxing type if the base type is simple type.
39+
*/
40+
</#if>
41+
public static Class<?> getBaseClass()
2442
{
2543
return ${baseClassName}.class;
2644
}

compiler/extensions/java/runtime/src/zserio/runtime/ZserioSubtype.java

+2-20
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,9 @@
22

33
/**
44
* Interface implemented by all subtypes generated by Zserio.
5+
*
6+
* This interface is empty because subtypes generated by Zserio contain only static methods.
57
*/
68
public interface ZserioSubtype
79
{
8-
/**
9-
* Gets the package of the base type which is resolved from the subtype.
10-
*
11-
* @return The package of the base type or null if the base type is simple type.
12-
*/
13-
String getBaseTypePackage();
14-
15-
/**
16-
* Gets the name of the base type which is resolved from the subtype.
17-
*
18-
* @return The name of the base type.
19-
*/
20-
String getBaseTypeName();
21-
22-
/**
23-
* Gets the class of the base type which is resolved from the subtype.
24-
*
25-
* @return The class of the base type or the class of boxing type if the base type is simple type.
26-
*/
27-
Class<?> getBaseClass();
2810
}

0 commit comments

Comments
 (0)