Before everyone here gets too far ahead of themselves, can we please stop over-engineering.
It looks like we simply need to generate a .java file that contains a single class with static final members, each one corresponding to a file in some directory (presumably something like src/main/resources/images that's guaranteed to be JAR'd and visible on the classpath at runtime) The actual code generation will be a trivial "7 lines in your favourite scripting language" sort of affair, so let's call it 20-30 lines in Java (i.e. still not exactly massive). Just to be safe, you'll want it to be regenerated as an automatic part of your build process, so do whatever it takes to turn into an ant/maven/gradle/rake/sbt/whatever task. Sure, this'll add a lump more boilerplate, but at least you can find templates (a.k.a. pre-written lumps of boilerplate) for that kind of thing; so the pain level remains low. I know the trend in Java is to avoid static typing like the plague (think of Spring's XML configuration files, or anything that uses strings in annotations heavily), but I'm really at a loss to see why this problem needs property files, annotation processors, deep IDE integration, or anything else of that nature. On 23 June 2011 12:41, Fabrizio Giudici <[email protected]>wrote: > On 06/23/2011 01:26 PM, Casper Bang wrote: > >> So why it hasn't been done already? >>> >> Because it's not very Java'sque to use code generation tools and an >> official pluggable annotation processor only arrived with JSE6? It's >> might have been a nice extension to JSR-296 but alas, Sun wanted to >> push JavaFX instead. >> > Hey, there's a thing named community. While it could be done with an > annotation processor, it could be just done with a much simpler Maven > plugin. Too bad this week for me is hot, otherwise I'd seriously start > thinking of it (considering that I use NetBeans NbBundle in place of > ResourceBundle, and it's unlikely that if something exists, it supports > NbBundle). > > > -- Kevin Wright gtalk / msn : [email protected] <[email protected]>mail: [email protected] vibe / skype: kev.lee.wright quora: http://www.quora.com/Kevin-Wright twitter: @thecoda "My point today is that, if we wish to count lines of code, we should not regard them as "lines produced" but as "lines spent": the current conventional wisdom is so foolish as to book that count on the wrong side of the ledger" ~ Dijkstra -- You received this message because you are subscribed to the Google Groups "The Java Posse" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/javaposse?hl=en.
