Re: ReflectData and enum

2025-04-04 Thread Bagi
Just wanted to add that the Java reflection is able to fetch the enum like in the example I posted earlier: Class myClass = AvroTest.class; Class[] declaredClasses = myClass.getDeclaredClasses(); Then loop through declaredClasses, check if its 'isEnum()', if yes - 'getName()' and 'getEnumConstant

Re: ReflectData and enum

2025-04-03 Thread Bagi
Thank you for your explanation, much appreciated. I ended up with one record type schema and one enum type schema, and combined them with union. Cheers! On Thu, 3 Apr 2025, 09:10 Martin Grigorov, wrote: > Class fields are mapped to Record schema fields. > To be able to set values you need an ins

Re: ReflectData and enum

2025-04-02 Thread Martin Grigorov
Class fields are mapped to Record schema fields. To be able to set values you need an instance of the type, i. e. a class field. On Wed, 2 Apr 2025 at 12:20, Bagi wrote: > Just wanted to add that the Java reflection is able to fetch the enum like > in the example I posted earlier: > > Class myCl

Re: ReflectData and enum

2025-04-02 Thread Bagi
Hi Martin, Many thanks for your reply. I am not saying it's behaving incorrectly, just trying to find a way to have the enum shown in the schema. I have class like that, where there is enum defined but not the field with its type. I only just started with Avro and wanted to check if that is possib

Re: ReflectData and enum

2025-04-01 Thread Martin Grigorov
Hi, IMO it behaves correctly! AvroTest class is mapped to a Record schema and its class fields are mapped to record fields. What kind of schema do you expect to be generated without the fields? On Tue, 1 Apr 2025 at 13:07, Bagi wrote: > Hi, > > Newb here. Having an issue with generating the s

ReflectData and enum

2025-04-01 Thread Bagi
Hi, Newb here. Having an issue with generating the schema when there is an enum at the top of the tree. Using Avro 1.12.0, I am trying to generate .avsc file from Java class file, using the following command: ReflectData.get().getSchema(AvroTest.class); Here is the AvroTest.java: public class Avr