Well, do you want the good news or the bad news first?

Bad news: the google-api-client-java doesn't have service-specific notions
such as SpreadsheetFeed.  It's really just a toolkit for working with any
REST-based XML or JSON that's been shoehorned into an ATOM meta-format.

Good news: the google-api-client-java is very flexible and once you get your
head around it.  Consider this:

   public class SpreadsheetFeed {
        @Key("entry")
        List<Entry> entries;
   }

   public class Entry {
        @Key
        String id;
   }

... and the magic line:

   myHttpRequest.execute(myTransport).parseAs(SpreadsheetFeed.class);

  ... gives you a SpreadsheetFeed object populated with Entry's.


So you just invent an object-model which closely follows the structure of
the XML/JSON you're going to be parsing, mark it up with @Key tags, and
you're done writing your parser.  It also supports generating the relevant
XML/JSON from an object graph.

And yes: if you, me and Joe all use google-api-client-java to access the
*Google spreadsheet API*, then we *all* write that same model over and over
again.  If we had sense, and failed to beat any of it into the Google Labs
team, we users would get together and pool our efforts to make a canonical
usage of the google-api-client-java for the spreadsheets API.  If we could
find time off our own project, that is.

In short, there is nothing like what normal applications developer think of
when they think 'API':

    Spreadsheet spread = Spreadsheet.get(myTransport, myKey);
    List<Worksheet> sheets = spread.getWorksheets();
    for (Worksheet sheet : sheets) {
        Row[] rows = sheet.getRows();
        /* etc */
    }

Now it would be a fair criticism to say that the above API wouldn't be
appropriate for some usages, since it's an 'in memory' API.  However, I
fancy it'd be on the '80' side of the 80/20 rule.


Since we currently lack an API like that, your next best recourse is to
start with the samples.  You might want to vote for
http://code.google.com/p/google-api-java-client/issues/detail?id=65&can=5&colspec=Milestone%20Priority%20Component%20Type%20Summary%20ID%20Statusbut
I wouldn't hold your breath.  I'd be copying the
http://samples.google-api-java-client.googlecode.com/hg/calendar-v2-atom-android-sample/instructions.html?r=defaultsample
and working out how to make your own SpreadsheetFeed and
SpreadsheetUrl instead of CalendarFeed and CalendarUrl.


Don't shoot the messenger!

cheers,
David.




On Tue, Apr 19, 2011 at 2:54 AM, christophe peixoto <
[email protected]> wrote:

> Nobody can help me? =S

Reply via email to