diff options
| author | Michael Williamson <mike@zwobble.org> | 2026-08-08 23:06:06 +0100 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2026-08-08 23:06:06 +0100 |
| commit | 765357e0d65c3f869344d8e86321fbed72edbcd6 (patch) | |
| tree | 5d278dfa4c29a069ae3edccacad74b9f3c094276 /examples/15-transient-0/output | |
| parent | 39e34d4f524f5492065ba47b6cd33d5f272cd515 (diff) | |
Support nested constructed native types in java-transient-0
Diffstat (limited to 'examples/15-transient-0/output')
3 files changed, 44 insertions, 2 deletions
diff --git a/examples/15-transient-0/output/java/src/main/java/org/zwobble/example/types/data/transient0/HobgoblinTransient0Data.java b/examples/15-transient-0/output/java/src/main/java/org/zwobble/example/types/data/transient0/HobgoblinTransient0Data.java index 0044a4a..1eea54c 100644 --- a/examples/15-transient-0/output/java/src/main/java/org/zwobble/example/types/data/transient0/HobgoblinTransient0Data.java +++ b/examples/15-transient-0/output/java/src/main/java/org/zwobble/example/types/data/transient0/HobgoblinTransient0Data.java @@ -276,11 +276,13 @@ public final class HobgoblinTransient0Data { public static void encodeStructWithGenericNative(org.zwobble.example.types.data.StructWithGenericNative value, java.io.OutputStream outputStream, java.util.Map<org.zwobble.example.types.transient0.HobgoblinTransient0TaggedSharedValue, java.lang.Long> sharedValues) throws java.io.IOException { org.zwobble.example.types.data.transient0.HobgoblinTransient0Data.encodeGenericNative(value.a(), outputStream, sharedValues, org.zwobble.example.types.transient0.HobgoblinTransient0Builtins::encodeInt32, org.zwobble.example.types.transient0.HobgoblinTransient0Builtins::encodeString); + org.zwobble.example.types.data.transient0.HobgoblinTransient0Data.encodeGenericNative(value.b(), outputStream, sharedValues, org.zwobble.example.types.data.transient0.HobgoblinTransient0Data::encode$constructedType$0, org.zwobble.example.types.data.transient0.HobgoblinTransient0Data::encode$constructedType$1); } public static org.zwobble.example.types.data.StructWithGenericNative decodeStructWithGenericNative(java.io.InputStream inputStream, java.util.List<java.lang.Object> sharedValues) throws java.io.IOException { var a = org.zwobble.example.types.data.transient0.HobgoblinTransient0Data.decodeGenericNative(inputStream, sharedValues, org.zwobble.example.types.transient0.HobgoblinTransient0Builtins::decodeInt32, org.zwobble.example.types.transient0.HobgoblinTransient0Builtins::decodeString); - return new org.zwobble.example.types.data.StructWithGenericNative(a); + var b = org.zwobble.example.types.data.transient0.HobgoblinTransient0Data.decodeGenericNative(inputStream, sharedValues, org.zwobble.example.types.data.transient0.HobgoblinTransient0Data::decode$constructedType$0, org.zwobble.example.types.data.transient0.HobgoblinTransient0Data::decode$constructedType$1); + return new org.zwobble.example.types.data.StructWithGenericNative(a, b); } public static void encodeStructWithBox(org.zwobble.example.types.data.StructWithBox value, java.io.OutputStream outputStream, java.util.Map<org.zwobble.example.types.transient0.HobgoblinTransient0TaggedSharedValue, java.lang.Long> sharedValues) throws java.io.IOException { @@ -498,6 +500,43 @@ public final class HobgoblinTransient0Data { return new org.zwobble.example.types.data.StructWithSharedSumAndVariant(a, b); } + private static void encode$constructedType$0(java.util.Optional<String> value, java.io.OutputStream outputStream, java.util.Map<org.zwobble.example.types.transient0.HobgoblinTransient0TaggedSharedValue, java.lang.Long> sharedValues) throws java.io.IOException { + org.zwobble.example.types.transient0.HobgoblinTransient0Builtins.encodeBool(value.isPresent(), outputStream, sharedValues); + if (value.isPresent()) { + org.zwobble.example.types.transient0.HobgoblinTransient0Builtins.encodeString(value.get(), outputStream, sharedValues); + } + } + + private static java.util.Optional<String> decode$constructedType$0(java.io.InputStream inputStream, java.util.List<java.lang.Object> sharedValues) throws java.io.IOException { + var value$isPresent = org.zwobble.example.types.transient0.HobgoblinTransient0Builtins.decodeBool(inputStream, sharedValues); + java.util.Optional<String> value; + if (value$isPresent) { + var value$element = org.zwobble.example.types.transient0.HobgoblinTransient0Builtins.decodeString(inputStream, sharedValues); + value = java.util.Optional.of(value$element); + } else { + value = java.util.Optional.empty(); + } + return value; + } + + private static void encode$constructedType$1(org.zwobble.example.types.data.GenericNative<java.util.Optional<String>, org.zwobble.example.types.data.GenericNative<String, String>> value, java.io.OutputStream outputStream, java.util.Map<org.zwobble.example.types.transient0.HobgoblinTransient0TaggedSharedValue, java.lang.Long> sharedValues) throws java.io.IOException { + org.zwobble.example.types.data.transient0.HobgoblinTransient0Data.encodeGenericNative(value, outputStream, sharedValues, org.zwobble.example.types.data.transient0.HobgoblinTransient0Data::encode$constructedType$0, org.zwobble.example.types.data.transient0.HobgoblinTransient0Data::encode$constructedType$2); + } + + private static org.zwobble.example.types.data.GenericNative<java.util.Optional<String>, org.zwobble.example.types.data.GenericNative<String, String>> decode$constructedType$1(java.io.InputStream inputStream, java.util.List<java.lang.Object> sharedValues) throws java.io.IOException { + var value = org.zwobble.example.types.data.transient0.HobgoblinTransient0Data.decodeGenericNative(inputStream, sharedValues, org.zwobble.example.types.data.transient0.HobgoblinTransient0Data::decode$constructedType$0, org.zwobble.example.types.data.transient0.HobgoblinTransient0Data::decode$constructedType$2); + return value; + } + + private static void encode$constructedType$2(org.zwobble.example.types.data.GenericNative<String, String> value, java.io.OutputStream outputStream, java.util.Map<org.zwobble.example.types.transient0.HobgoblinTransient0TaggedSharedValue, java.lang.Long> sharedValues) throws java.io.IOException { + org.zwobble.example.types.data.transient0.HobgoblinTransient0Data.encodeGenericNative(value, outputStream, sharedValues, org.zwobble.example.types.transient0.HobgoblinTransient0Builtins::encodeString, org.zwobble.example.types.transient0.HobgoblinTransient0Builtins::encodeString); + } + + private static org.zwobble.example.types.data.GenericNative<String, String> decode$constructedType$2(java.io.InputStream inputStream, java.util.List<java.lang.Object> sharedValues) throws java.io.IOException { + var value = org.zwobble.example.types.data.transient0.HobgoblinTransient0Data.decodeGenericNative(inputStream, sharedValues, org.zwobble.example.types.transient0.HobgoblinTransient0Builtins::decodeString, org.zwobble.example.types.transient0.HobgoblinTransient0Builtins::decodeString); + return value; + } + // Custom area start: org.zwobble.example.types.data.transient0.HobgoblinTransient0Data body public static void encodeNative( Native value, diff --git a/examples/15-transient-0/output/rust/src/gen/data.rs b/examples/15-transient-0/output/rust/src/gen/data.rs index 856d60f..6f1d5b5 100644 --- a/examples/15-transient-0/output/rust/src/gen/data.rs +++ b/examples/15-transient-0/output/rust/src/gen/data.rs @@ -124,6 +124,7 @@ pub struct StructWithNative { #[derive(Clone, Debug, Hash, PartialEq)] pub struct StructWithGenericNative { pub a: crate::data::GenericNative::<::core::primitive::i32, ::std::string::String>, + pub b: crate::data::GenericNative::<::std::option::Option::<::std::string::String>, crate::data::GenericNative::<::std::option::Option::<::std::string::String>, crate::data::GenericNative::<::std::string::String, ::std::string::String>>>, } #[derive(Clone, Debug, Hash, PartialEq)] diff --git a/examples/15-transient-0/output/rust/src/gen/data/transient_0.rs b/examples/15-transient-0/output/rust/src/gen/data/transient_0.rs index c497b57..383a564 100644 --- a/examples/15-transient-0/output/rust/src/gen/data/transient_0.rs +++ b/examples/15-transient-0/output/rust/src/gen/data/transient_0.rs @@ -276,12 +276,14 @@ pub fn decode_struct_with_native(reader: &mut impl std::io::Read, shared_values: pub fn encode_struct_with_generic_native(value: &crate::data::StructWithGenericNative, writer: &mut impl std::io::Write, shared_values: &mut ::std::collections::HashMap::<::core::primitive::usize, ::core::primitive::i64>) -> ::std::io::Result::<()> { todo!(); + todo!(); ::std::io::Result::Ok(()) } pub fn decode_struct_with_generic_native(reader: &mut impl std::io::Read, shared_values: &mut ::std::vec::Vec::<::std::sync::Arc::<dyn ::std::any::Any + ::std::marker::Sync + ::std::marker::Send>>) -> ::std::io::Result::<crate::data::StructWithGenericNative> { let a = todo!(); - ::std::io::Result::Ok(crate::data::StructWithGenericNative { a: a }) + let b = todo!(); + ::std::io::Result::Ok(crate::data::StructWithGenericNative { a: a, b: b }) } pub fn encode_struct_with_box(value: &crate::data::StructWithBox, writer: &mut impl std::io::Write, shared_values: &mut ::std::collections::HashMap::<::core::primitive::usize, ::core::primitive::i64>) -> ::std::io::Result::<()> { |
