Package com.restfb

Class Parameter

java.lang.Object
com.restfb.Parameter

public final class Parameter extends Object
Representation of a Facebook API request parameter.
Author:
Mark Allen
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    final String
    Parameter name.
    final String
    Parameter value.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
     
    int
     
     
    static Parameter
    with(String name, Object value)
    Factory method which provides an instance with the given name and value.
    static Parameter
    with(String name, Object value, JsonMapper jsonMapper)
    Factory method which provides an instance with the given name and value, using the provided jsonMapper to turn value into a JSON string.
    static Parameter
    withFields(String fieldList)
    convenience factory method which needs a comma separated list of fields that the dev likes to fetch from the API
    static Parameter
    withLimit(int limit)
    convenience factory method which creates a Parameter object to fetch data from API with given limit
    static Parameter
    convenience factory method which creates a Parameter object to fetch data from API with given locale
    static Parameter
    convenience factory method which creates a Parameter object to post an object with a message parameter to the API
    static Parameter
    Convenience factory method that creates a Parameter object to retrieve the metadata from the API.
    static Parameter
    withQuery(String queryString)
    convenience factory method which creates a Parameter object to query some information e.g. searching profiles the API

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

  • Method Details

    • with

      public static Parameter with(String name, Object value)
      Factory method which provides an instance with the given name and value.

      The value parameter is often a String or primitive type like Integer, but you may pass in a List, Map, or your own @Facebook-annotated Javabean, and it will be converted to JSON automatically. See the "attachment" section of the stream.publish API documentation for an example of where this is useful.

      Parameters:
      name - The parameter name.
      value - The parameter value.
      Returns:
      A Parameter instance with the given name and value.
      Throws:
      IllegalArgumentException - If name or value is null or a blank string.
      FacebookJsonMappingException - If an error occurs when converting value to JSON.
    • withFields

      public static Parameter withFields(String fieldList)
      convenience factory method which needs a comma separated list of fields that the dev likes to fetch from the API
      Parameters:
      fieldList - comma separated list of fields
      Returns:
      Parameter object
    • withMetadata

      public static Parameter withMetadata()
      Convenience factory method that creates a Parameter object to retrieve the metadata from the API.
      Returns:
      Parameter object
    • withLocale

      public static Parameter withLocale(Locale locale)
      convenience factory method which creates a Parameter object to fetch data from API with given locale
      Parameters:
      locale - the locale that should be used to fetch the data
      Returns:
      Parameter object
    • withLimit

      public static Parameter withLimit(int limit)
      convenience factory method which creates a Parameter object to fetch data from API with given limit
      Parameters:
      limit - the limit that should be used fetching data
      Returns:
      Parameter object
    • withMessage

      public static Parameter withMessage(Object obj)
      convenience factory method which creates a Parameter object to post an object with a message parameter to the API
      Parameters:
      obj - The content of the message, should be a String, but maybe some JSON
      Returns:
      Parameter object
    • withQuery

      public static Parameter withQuery(String queryString)
      convenience factory method which creates a Parameter object to query some information e.g. searching profiles the API
      Parameters:
      queryString - the String used in the query
      Returns:
      Parameter object
    • with

      public static Parameter with(String name, Object value, JsonMapper jsonMapper)
      Factory method which provides an instance with the given name and value, using the provided jsonMapper to turn value into a JSON string.

      The value parameter is often a String or primitive type like Integer, but you may pass in a List, Map, or your own @Facebook-annotated Javabean, and it will be converted to JSON automatically. See the "attachment" section of the stream.publish API documentation for an example of where this is useful.

      Parameters:
      name - The parameter name.
      value - The parameter value.
      jsonMapper - The jsonMapper
      Returns:
      A Parameter instance with the given name and value.
      Throws:
      IllegalArgumentException - If name or value is null or a blank string.
      FacebookJsonMappingException - If an error occurs when converting value to JSON.
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
      See Also:
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object