--
You received this message because you are subscribed to the Google Groups "The Java Posse" group.
To post to this group, send email to java...@googlegroups.com.
To unsubscribe from this group, send email to javaposse+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/javaposse?hl=en.
I would prefer to avoid adding two lines for declaring two fields (even
though I agree that it's important to shrink code in the body of
methods, less important in field declarations). I'm with Sam and I would
like to see:
|
view.notifyFeedUnavailable(notification().withCaption(R.string.unavailableNewsTitle)
.withText(R.string.unavailableNewsMessage));|
Note that this would be slightly better than Android R - those plain int
constants need casts everywhere - it has been discussed here in past,
and Google's version is that plain integer constants allow faster code -
reasonable thinking of 2008, maybe not in 2011. In any case, it wouldn't
be reasonable in J2SE. So, if somebody is going to do that, please use a
special Key<T> object which would avoid casts.
In any case, it shouldn't be too complex to do that. Android has to
compile resources in a binary format that is efficient at runtime in the
device, while in J2SE we just need a wrapper on existing library classes
such as ResourceBundle or NbBundle. Probably a Maven plugin for doing
that would be quite simple.
--
Fabrizio Giudici - Java Architect, Project Manager
Tidalwave s.a.s. - "We make Java work. Everywhere."
java.net/blog/fabriziogiudici - www.tidalwave.it/people
Fabrizio...@tidalwave.it
I would prefer to avoid adding two lines for declaring two fields (even though I agree that it's important to shrink code in the body of methods, less important in field declarations). I'm with Sam and I would like to see:
|
view.notifyFeedUnavailable(notification().withCaption(R.string.unavailableNewsTitle)
.withText(R.string.unavailableNewsMessage));|
Note that this would be slightly better than Android R - those plain int constants need casts everywhere - it has been discussed here in past, and Google's version is that plain integer constants allow faster code - reasonable thinking of 2008, maybe not in 2011. In any case, it wouldn't be reasonable in J2SE.
So, if somebody is going to do that, please use a special Key<T> object which would avoid casts.
I doubt this would take you more than a single man-day of work, including testing.
On 06/23/2011 01:26 PM, Casper Bang wrote: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).
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.
Because it's not very Java'sque to use code generation tools and an
official pluggable annotation processor only arrived with JSE6?
Anyways, since our project uses an unconventional way of storing and
loading resources, this may be of limited reusability for others, but
in case you are interested, you can view my solution in our
repository:
Resource generator: http://goo.gl/QDNxG
Example generated file: http://goo.gl/k8qNI
The repository is not fully public so to log in or checkout you have
to use username and password = guest
I'm torn on the Android R generator running behind, on one hand I
understand its purpose (this is how it works in .NET), on the other
hand I am not certain the folloing code:
Drawable image = getResources().getDrawable(R.drawable.myimage);
String mystring = this.getString(R.string.mystring);
ImageView imageView = (ImageView) findViewById(R.id.myimageview);
...is more consistent, more type-safe or as mockable as:
Drawable image = getResources().get(Drawable.class, "myimage")
String mystring = getResources().get(String.class, "mystring");
ImageView imageView = findViewById(imageView.class,"myimageview");
The blanket license for our project is GPL:
http://phet.colorado.edu/en/about/licensing
However, I think this component of our build tools is unencumbered and
could probably be relicensed as LGPL if that's better for you--let me
know if so and I'll bring it up at our next meeting.
Before everyone here gets too far ahead of themselves, can we please stop over-engineering.