/facebook-java-api/src/main/java/com/google/code/facebookapi/FeedUserPhoto.java

http://facebook-java-api.googlecode.com/ · Java · 55 lines · 23 code · 6 blank · 26 comment · 5 complexity · 75e296f80f8e8201a8a12212d2b76867 MD5 · raw file

  1. package com.google.code.facebookapi;
  2. import java.net.URL;
  3. /**
  4. * A simple Pair consisting of a Facebook Photos photo ID for an image appearing in a newsfeed/minifeed story and the destination URL for a click on that image.
  5. *
  6. * @see IFacebookRestClient
  7. * @see IFacebookRestClient#photos_get
  8. * @see FacebookRestClient#handleFeedImages
  9. */
  10. @SuppressWarnings("serial")
  11. public class FeedUserPhoto extends Pair<Object,URL> implements IFeedImage {
  12. /**
  13. * Creates a linked Facebook Photos photo to appear in a user's newsfeed/minifeed.
  14. *
  15. * @param userId
  16. * the photo ID of a Facebook photo to appear in a user's newsfeed/minifeed
  17. * @param link
  18. * the URL to which the image should link
  19. * @see IFacebookRestClient#photos_get
  20. * @see FacebookRestClient#handleFeedImages
  21. */
  22. public FeedUserPhoto( Long userId, URL link ) {
  23. super( userId, link );
  24. if ( null == userId || null == link ) {
  25. throw new IllegalArgumentException( "Both userId and linkUrl should be provided" );
  26. }
  27. if ( 0 >= userId ) {
  28. throw new IllegalArgumentException( "photoId should be a Facebook user ID" );
  29. }
  30. }
  31. /**
  32. * @return the Facebook user ID of the feed image
  33. */
  34. public Object getUserId() {
  35. return getFirst();
  36. }
  37. /**
  38. * @return the String representation of the feed image "URL"
  39. */
  40. public String getImageUrlString() {
  41. return getFirst().toString();
  42. }
  43. /**
  44. * @return the link URL to which the feed image should link
  45. */
  46. public URL getLinkUrl() {
  47. return getSecond();
  48. }
  49. }