PageRenderTime 5ms CodeModel.GetById 1ms app.highlight 1ms RepoModel.GetById 2ms app.codeStats 0ms

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