IntentArchitect / Support

A repository dedicated to handling issues and support queries
3 stars 0 forks source link

Creating Generic Java class #35

Closed leonAtRain closed 1 year ago

leonAtRain commented 1 year ago

Ask a question

I'm using the new Java Builder Template, to create a new class, but I want to create a Generic Java class... problem is I could not find a proper way (or that I could see) to do this, so I "hacked" it like this, but I would like to know what is the proper way to do this.

.AddClass($"DroolRuleCompiler", c => { c.WithBaseType("T"); })

and in TransformText:

return JavaFile.ToString().Replace(" extends T", "");

So is there a way to this without doing the "replace" portion?

dandrejvv commented 1 year ago

Good day @leonAtRain,

The JavaFileBuilder does not yet have support for defining Generic types, but as this is something you clearly now need, we can prioritise getting it added in the short term.

Although absolutely in no way expected, in the event you would like to update the JavaFileBuilder yourself sooner, we would be happy to provide guidance to you being able to make a pull request with the improvements in the Intent.Modules repository. The FileBuilder itself is over here with unit tests over here.

dandrejvv commented 1 year ago

This feature has been completed as part of this commit 0c463f5 as I've added support for Generics on a Class and Method level.