File tree Expand file tree Collapse file tree 2 files changed +13
-6
lines changed
jsonb-generator/src/main/java/io/avaje/jsonb/generator Expand file tree Collapse file tree 2 files changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -53,8 +53,14 @@ void write() throws IOException {
53
53
54
54
private void writeFactory () {
55
55
if (genericParamsCount > 0 ) {
56
+
57
+ String typeName = adapterShortName ;
58
+ int nestedIndex = adapterShortName .indexOf ("$" );
59
+ if (nestedIndex != -1 ) {
60
+ typeName = typeName .substring (nestedIndex + 1 );
61
+ }
56
62
writer .append (" public static final JsonAdapter.Factory Factory = (type, jsonb) -> {" ).eol ();
57
- writer .append (" if (type instanceof ParameterizedType && Types.rawType(type) == %s.class) {" , adapterShortName ).eol ();
63
+ writer .append (" if (type instanceof ParameterizedType && Types.rawType(type) == %s.class) {" , typeName ).eol ();
58
64
writer .append (" Type[] args = Types.typeArguments(type);" ).eol ();
59
65
writer .append (" return new %sJsonAdapter(jsonb" , adapterShortName );
60
66
for (int i = 0 ; i < genericParamsCount ; i ++) {
Original file line number Diff line number Diff line change @@ -53,11 +53,12 @@ void writeMetaInf() throws IOException {
53
53
private void writeRegister () {
54
54
writer .append (" @Override" ).eol ();
55
55
writer .append (" public void register(Jsonb.Builder builder) {" ).eol ();
56
- List <String > strings = metaData .allFactories ();
57
- for (String adapterFullName : strings ) {
58
- String adapterShortName = Util .shortName (adapterFullName );
59
- String typeName = typeShortName (adapterShortName );
60
- writer .append (" builder.add(%sJsonAdapter.Factory);" , typeName ).eol ();
56
+ final List <String > strings = metaData .allFactories ();
57
+ for (final String adapterFullName : strings ) {
58
+ final String adapterShortName = Util .shortName (adapterFullName );
59
+ final String typeName = typeShortName (adapterShortName );
60
+
61
+ writer .append (" builder.add(%s.Factory);" , adapterShortName ).eol ();
61
62
}
62
63
for (String adapterFullName : metaData .all ()) {
63
64
String adapterShortName = Util .shortName (adapterFullName );
You can’t perform that action at this time.
0 commit comments