Adding a model for Twitter

There are still a couple of other interfaces that we need to implement to finish our Twitter support. The first, and simpler, one is SocialMediaItem:

    public interface SocialMediaItem { 
      String getProvider(); 
      String getTitle(); 
      String getBody(); 
      String getUrl(); 
      String getImage(); 
      Date getTimestamp(); 
    } 

This preceding interface provides us with a nice abstraction over the various types of data that a social network might return without being too heavily burdened with fields that aren't used by most (or many, at least) networks. The Twitter implementation of this Tweet class is as follows:

 public class Tweet implements SocialMediaItem { private final Status status; private final String url; private final String ...

Get Java 9: Building Robust Modular Applications now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.