Class TweetUtility


  • public class TweetUtility
    extends java.lang.Object
    Author:
    ubaldino
    • Constructor Summary

      Constructors 
      Constructor Description
      TweetUtility()  
    • Method Summary

      Modifier and Type Method Description
      protected static Geocoding getGeo​(jodd.json.JsonObject attrs, boolean isUser)
      TOOD: validate available data for this schema.
      protected static void insertGeo​(jodd.json.JsonObject o, Geocoding geo, boolean isUser)
      TOOD: validate available data for this schema.
      static void insertMention​(jodd.json.JsonArray a, java.lang.String u, java.lang.String id)
      Serialize a user screen name / ID pairing., e.g.
      static void insertMention​(jodd.json.JsonArray a, Tweet.Mention m)
      Variation on insertMention(a, name, uid)
      static boolean isValue​(java.lang.String str)  
      static jodd.json.JsonObject toJSON​(Tweet tw)  
      static jodd.json.JsonObject toJSON​(Tweet tw, boolean includeGeo, boolean formatDate)
      Objective of this is to create a FLAT key/value map for a JSON or a simple HashMap to use.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • TweetUtility

        public TweetUtility()
    • Method Detail

      • isValue

        public static boolean isValue​(java.lang.String str)
      • toJSON

        public static jodd.json.JsonObject toJSON​(Tweet tw)
      • toJSON

        public static jodd.json.JsonObject toJSON​(Tweet tw,
                                                  boolean includeGeo,
                                                  boolean formatDate)
        Objective of this is to create a FLAT key/value map for a JSON or a simple HashMap to use.
        Parameters:
        tw - tweet obj
        includeGeo - include geo* fields
        formatDate - true if date should be in both text and epoch
        Returns:
        JSON
      • insertGeo

        protected static void insertGeo​(jodd.json.JsonObject o,
                                        Geocoding geo,
                                        boolean isUser)
        TOOD: validate available data for this schema.
        Parameters:
        o -
        geo -
        isUser -
      • getGeo

        protected static Geocoding getGeo​(jodd.json.JsonObject attrs,
                                          boolean isUser)
        TOOD: validate available data for this schema.
        Parameters:
        attrs - given attributes
        isUser - if attributes represent user profile
        Returns:
        geocoding object populated with attribute data
      • insertMention

        public static void insertMention​(jodd.json.JsonArray a,
                                         java.lang.String u,
                                         java.lang.String id)
        Serialize a user screen name / ID pairing., e.g. a mention of a friend. If just screen name or ID is available, then each item is added separately.
        Parameters:
        a - target array
        u - user name
        id - mention
      • insertMention

        public static void insertMention​(jodd.json.JsonArray a,
                                         Tweet.Mention m)
        Variation on insertMention(a, name, uid)