PROPOSAL: Method and Field Literals

Jesse Wilson jesse at swank.ca
Thu Mar 12 00:05:28 PDT 2009


On Wed, Mar 11, 2009 at 9:48 PM, Reinier Zwitserloot <
reinier at zwitserloot.com> wrote:

> What's this useful for, exactly? Can anyone name me one non-exotic
> use-case?


In Glazed Lists we have an interface called
TableFormat<http://publicobject.com/glazedlists/glazedlists-1.7.0/api/ca/odell/glazedlists/gui/TableFormat.html>that
maps a value object to its columns for a table. A concise API to
access
methods would be convenient:
  TableFormat songsTableFormat = new TableFormat.Builder()
      .addColumn("Name", Song#getSongName())
      .addColumn("Track #", Song#getTrackNumber())
      .addColumn("Artist", Song#getArtist())
      .addColumn("Album", Song#getAlbum())
      .build();

Google Code Search suggests another 7,000 immediate candidates:
http://www.google.com/codesearch?hl=en&lr=&q=%5C.class%5C.getMethod%5C%28%5C%22&sbtn=Search

This includes code from Apache HTTP client, Log4J, Ant, JPA, SwingX, EJB,
SAX, Google Collections, GWT, Hibernate, Seam, MySQL, Equinox, Eclipse...
you name it.



More information about the coin-dev mailing list