Class TwitterProxyReader

Direct Known Subclasses:
TwitterUserLookupReader

public abstract class TwitterProxyReader extends IntegrationProxyReader
Base class for all Twitter ProxyReaders.
  • Field Details

    • EOF

      protected static final Record EOF
  • Constructor Details

  • Method Details

    • open

      public void open() throws DataException
      Description copied from class: DataEndpoint
      Makes this endpoint ready for reading or writing.
      Overrides:
      open in class IntegrationProxyReader
      Throws:
      DataException
    • getProvider

      public TwitterProvider getProvider()
    • getApiLimitPolicy

      public IApiLimitPolicy getApiLimitPolicy()
      Returns the action taken when the API call limit is reached (defaults to ApiLimitPolicy.FAIL).
    • setApiLimitPolicy

      public TwitterProxyReader setApiLimitPolicy(IApiLimitPolicy apiLimitPolicy)
      Sets the action taken when the API call limit is reached (defaults to ApiLimitPolicy.FAIL).
    • getRateLimit

      public final TwitterRateLimit getRateLimit()
      Returns the cached rate limit, fetching it from the API only if none has been loaded.
    • onRateLimitExceeded

      protected boolean onRateLimitExceeded()
      Marks the rate limit as exceeded and returns the API limit policy's answer: true to retry, false to stop reading.
    • setRateLimitExceeded

      protected TwitterProxyReader setRateLimitExceeded(boolean rateLimitExceeded)
    • isRateLimitExceeded

      public boolean isRateLimitExceeded()
    • getRateLimit

      public final TwitterRateLimit getRateLimit(boolean autoReload)
      Returns the rate limit, reloading it if none is cached or if autoReload is true and it has reset.
    • setRateLimit

      public TwitterProxyReader setRateLimit(TwitterResponse response)
      Updates the rate limit from the response's status; does nothing if the response or its status is null.
    • setRateLimit

      public TwitterProxyReader setRateLimit(RateLimitStatus rateLimitStatus)
      Replaces the cached rate limit; null clears it so the next getRateLimit() call reloads it from the API.
    • reloadRateLimit

      public final void reloadRateLimit()
      Fetches the current rate limit from the API, replacing the cached one.
    • getEntityExpansionPolicy

      public IEntityExpansionPolicy getEntityExpansionPolicy()
      Returns how multi-valued entity fields are stored (defaults to EntityExpansionPolicy.TO_STRING).
    • setEntityExpansionPolicy

      public TwitterProxyReader setEntityExpansionPolicy(IEntityExpansionPolicy entityExpansionPolicy)
      Sets how multi-valued entity fields are stored (defaults to EntityExpansionPolicy.TO_STRING).
    • getConverter

      public ITwitterConverter getConverter()
      Returns the converter that copies Twitter objects into records (defaults to ITwitterConverter.DEFAULT).
    • setConverter

      public TwitterProxyReader setConverter(ITwitterConverter converter)
      Sets the converter that copies Twitter objects into records (defaults to ITwitterConverter.DEFAULT).
    • addExceptionProperties

      public DataException addExceptionProperties(DataException exception)
      Description copied from class: Endpoint
      Adds this endpoint's current state to a DataException. Since this method is called whenever an exception is thrown, subclasses should override it to add their specific information.
      Overrides:
      addExceptionProperties in class ProxyReader