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

http://facebook-java-api.googlecode.com/ · Java · 56 lines · 23 code · 7 blank · 26 comment · 5 complexity · c808890d68ba0a97dd28c4f695b70522 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 FeedFacebookPhoto 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 photoId
  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 FeedFacebookPhoto( Long photoId, URL link ) {
  23. super( photoId, link );
  24. if ( null == photoId || null == link ) {
  25. throw new IllegalArgumentException( "Both photoId and linkUrl should be provided" );
  26. }
  27. if ( 0L >= photoId ) {
  28. throw new IllegalArgumentException( "photoId should be a Facebook Photos ID > 0" );
  29. }
  30. }
  31. /**
  32. * @return the Facebook Photos photo ID of the feed image
  33. */
  34. public Object getPhotoId() {
  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. }