Class Twitter


public class Twitter extends AbstractProvider<BaseProviders>
Creates fake Twitter messages.
Since:
0.9.0
  • Constructor Details

    • Twitter

      protected Twitter(BaseProviders faker)
      Parameters:
      faker - used as constructor
  • Method Details

    • createdTime

      public Date createdTime(boolean forward, Date base, Date constrains)
      Used to fake a new Twitter Date.
      Parameters:
      forward - to determined if the returned date is later (or before) the given date.
      base - the base date given as a start point.
      constrains - used to constrain the returned date range.
      Returns:
      a new date later (or before) the base date with respect to the constraint (no later/earlier than the constrain).
    • twitterId

      public String twitterId(int expectedLength)
      Used to fake a new Twitter ID without collision using both current time and uuid as seeds.
      Parameters:
      expectedLength - the expected length of the twitter id. Should be greater or equals to 6 and less than or equals to 25.
      Returns:
      a new Twitter ID consists of purely numbers.
    • text

      public String text(String[] keywords, int sentenceMaxLength, int wordMaxLength)
      To fake a new text context for the Twitter.
      Parameters:
      keywords - the keywords that you wish to appear in the text.
      sentenceMaxLength - the text should be in range of the sentence max length.
      wordMaxLength - each word should be in range of the word max length.
      Returns:
      a new fake text for the Twitter.
    • userName

      public String userName()
      Returns:
      Return a user name using the twitter.user_name.
    • userId

      public String userId()
      Returns:
      Return a user id using the twitter.user_name.
    • getLink

      public String getLink(String username, int extraLength)
      return a fake link to a Twitter message. The extra length is expected to be larger than 4.
      Parameters:
      username - the username will be used in the link.
      extraLength - the expected length of the extra link part.
      Returns:
      return a fake link to a Twitter message.