I'm dealing with a legacy Java project that currently uses restfb with the outdated version 1.6.11. When updating the version to 1.36.0 some warnings popped up due to deprecated methods. Most of them complained about missing a com.restfb.Version
, which I provided and everything is fine. But I'm a little stuck with the deprecation of com.restfb.types.User
's getUsername()
. Consulting the JavaDoc is not helpful as it does not give a hint what to use instead.
/**
* The user's Facebook username.
*
* @return The user's Facebook username.
* @since 1.6.5
* @deprecated since graph api 2.0
*/
@Deprecated
@Getter
@Setter
@Facebook
private String username;
What other method / other way is suitable to get that piece of information as it is needed further on in the code?
Somewhere else in the code I also found a compile error concerning com.restfb.types.Page
. getPicture()
once returned a String as the picture
which changed to com.restfb.types.ProfilePictureSource
. Is ProfilePictureSource
's url the same data as "the picture" or has this data to be processed?
Thanks in advance.
Long answer can be found in the RestFB Google group.
Short answer is:
username
was removed by Facebook with Graph API 2.0 so it is deprecated without an hint. There is not alternative.ProfilePictureSource
url field is the former Page's picture
field