#1772 Runtime Java Packages

SlimerDude Sun 12 Feb 2012

Hiya,

By fair means or foul, is there a way to alter which Java packages Fantom classes get loaded into at Runtime?

Although it may be the same code, I'm less concerned with compiling the classes into a jar.

My use case is that I'd like to use Fantom with Tapestry5. With that, you give T5 a base package, e.g. fan.mywebapp - it then looks for your classes in sub packages such as,

fan.mywebapp.base
fan.mywebapp.components
fan.mywebapp.mixins
fan.mywebapp.pages
fan.mywebapp.services

I've a feeling I'm onto a looser but thought it worth asking all the same! :)

Steve.

brian Sun 12 Feb 2012

My use case is that I'd like to use Fantom with Tapestry5. With that, you give T5 a base package, e.g. fan.mywebapp - it then looks for your classes in sub packages such as,

You could probably do it by hacking up the Java emitter, but it would be difficult because currently I optimize module resolution using the package pattern "fan.<pod>.<Type>". I have on my todo list to beef up that infrastructure so that we can use the Fantom module system to better resolve Java classes, which would be a step in this direction.

SlimerDude Sun 12 Feb 2012

Cheers, I may tentatively take a peek.

SlimerDude Sat 9 Jun 2012

Hi,

I've just taken another look at the emitter code but didn't get very far! Anyhow, was thinking that if ever this was addressed in the future, it'd be nice to have a facet on the class. Something like:

@JavaPackage{package="fan.mywebapp.pages"}
class MyPage {
    ....
}

Login or Signup to reply.