Package com.restfb
Class Parameter
java.lang.Object
com.restfb.Parameter
Representation of a Facebook API request parameter.
- Author:
- Mark Allen
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionbooleaninthashCode()toString()static ParameterFactory method which provides an instance with the givennameandvalue.static Parameterwith(String name, Object value, JsonMapper jsonMapper) Factory method which provides an instance with the givennameandvalue, using the providedjsonMapperto turnvalueinto a JSON string.static ParameterwithFields(String fieldList) convenience factory method which needs a comma separated list of fields that the dev likes to fetch from the APIstatic ParameterwithLimit(int limit) convenience factory method which creates aParameterobject to fetch data from API with given limitstatic ParameterwithLocale(Locale locale) convenience factory method which creates aParameterobject to fetch data from API with given localestatic ParameterwithMessage(Object obj) convenience factory method which creates aParameterobject to post an object with a message parameter to the APIstatic ParameterConvenience factory method that creates aParameterobject to retrieve the metadata from the API.static Parameterconvenience factory method which creates aParameterobject to query some information e.g. searching profiles the API
-
Field Details
-
name
Parameter name. -
value
Parameter value.
-
-
Method Details
-
with
Factory method which provides an instance with the givennameandvalue.The
valueparameter is often aStringor primitive type likeInteger, but you may pass in aList,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
Parameterinstance with the givennameandvalue. - Throws:
IllegalArgumentException- Ifnameorvalueisnullor a blank string.FacebookJsonMappingException- If an error occurs when convertingvalueto JSON.
-
withFields
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
Convenience factory method that creates aParameterobject to retrieve the metadata from the API.- Returns:
- Parameter object
-
withLocale
convenience factory method which creates aParameterobject to fetch data from API with given locale- Parameters:
locale- the locale that should be used to fetch the data- Returns:
- Parameter object
-
withLimit
convenience factory method which creates aParameterobject to fetch data from API with given limit- Parameters:
limit- the limit that should be used fetching data- Returns:
- Parameter object
-
withMessage
convenience factory method which creates aParameterobject 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
convenience factory method which creates aParameterobject to query some information e.g. searching profiles the API- Parameters:
queryString- the String used in the query- Returns:
- Parameter object
-
with
Factory method which provides an instance with the givennameandvalue, using the providedjsonMapperto turnvalueinto a JSON string.The
valueparameter is often aStringor primitive type likeInteger, but you may pass in aList,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
Parameterinstance with the givennameandvalue. - Throws:
IllegalArgumentException- Ifnameorvalueisnullor a blank string.FacebookJsonMappingException- If an error occurs when convertingvalueto JSON.
-
equals
-
hashCode
-
toString
-