GitHub user chaokunyang added a comment to the discussion: Generating Java code 
instead of runtime bytecode

Hi, I implemented xlang mode codegen in 
https://github.com/apache/fory/pull/2613. You can start with this commit, this 
will be easier. And I think you can let the annotation processor to invoke 
`ObjectCodecBuilder#genCode` to get the source code:

```java
    Fory fory =
        Fory.builder()
            .withLanguage(Language.JAVA)
            .withRefTracking(false)
            .withNumberCompressed(compressNumber)
            .requireClassRegistration(false)
            .build();
    new ObjectCodecBuilder(Foo.class, fory).genCode();
    // System.out.println(code);
    new ObjectCodecBuilder(BeanA.class, fory).genCode();
    new ObjectCodecBuilder(BeanB.class, fory).genCode();
    new 
ObjectCodecBuilder(Struct.createStructClass("ObjectCodecBuilderTestStruct", 1), 
fory)
        .genCode();
```

GitHub link: 
https://github.com/apache/fory/discussions/2608#discussioncomment-14405767

----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to: [email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to