bobolounna / restfb

Automatically exported from code.google.com/p/restfb
0 stars 0 forks source link

Provide PageConnections class #115

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Now that we have the PageConnection class for queries of connections to pages, 
it would be really nice to have a PageConnections class that can be mapped by 
the DefaultJsonMapper.

That way, it becomes possible to manually batch connection queries to pages and 
then map them to Java objects. Speeds up things a lot and can't even be done by 
batchfb.

Please find the suggested class attached. If the concept is not clear, I can 
also attach some demo code.

Original issue reported on code.google.com by kong...@gmail.com on 20 Feb 2011 at 12:49

Attachments:

GoogleCodeExporter commented 8 years ago
Having second thoughts, the same functionality can probably be achieved by 
using the existing Connection<?> class, but that would need to be convertable 
by the DefaultJasonMapper.

Any thoughts?

Original comment by kong...@gmail.com on 20 Feb 2011 at 7:08

GoogleCodeExporter commented 8 years ago
A few thoughts...

First, thanks for the idea and the code.  Providing concrete examples is really 
helpful for me.

Regarding your first comment, I tend to be conservative with adding to RestFB, 
especially around types (the original concept was that the end user would write 
his own @Facebook-annotated classes instead of the library providing them).  
While that's a bit too extreme, I do still feel like it's best to keep the API 
small and if a power user like you has a mapping edge case, it should be a 
simple matter for him to roll his own class to handle it.  It's conceptual 
weight for a new user to grok something like "ah, this PageConnections type is 
for when I want to batch-map page connections".  So is RestFB for the lowest 
common denominator?  Maybe it is :) But I remember trying to work with one of 
the older Java FB clients before I started on RestFB and thought, man - this is 
way too fucking complicated and I don't have time to dig through all the docs, 
I know what the JSON looks like, I just want to turn it into Java objects.

However, this does not mean I'm dismissing your idea.  Over time I've ended up 
rolling in patches/requests/etc. that I was originally not planning to.  So for 
now I'm marking as an unscheduled enhancement.

Oh, about your second comment...do you know if these are legit connections (IOW 
do they support paging)?  I did some tests myself and didn't see any paging 
fields returned, but I might not have friends who like enough music to 
accurately test this out.  Just curious more than anything.  Thanks!

Original comment by mark.a.a...@gmail.com on 23 Feb 2011 at 3:37

GoogleCodeExporter commented 8 years ago
Point taken, you're right to keep it simple and clean.

In any case, using the existing Connection<> class would be much more elegant 
anyway. I did some further tests and the page connections seem to be special. 
Even with large (e.g. > 50) connected pages there is no paging. I suspect that 
Facebook didn't implement paging for this type of connection as typically 
people will not connect to a large number of, e.g., favourite artists or books.

That doesn't mean that the Connection<> class wouldn't be appropriate. It could 
work with the mapper anyway - there is simply just one page.

So the mapper should handle Connection<PageConnection> to satisfy this 
functionality request. Should be possible, no?

Original comment by kong...@gmail.com on 23 Feb 2011 at 9:30