Skip to content
JonathanO edited this page Jun 3, 2012 · 5 revisions

JsonCreator

Used on the constructor or a static method to mark it as the factory method for this object. It optionally takes a single argument consisting of an array of @JsonProperty annotations, which will be used in specified order as the parameters to the factory/constructor.

When de-serializing the JsonCreator will be called to instantiate the object, and will be passed the specified properties from the JSON.

Parameters

  1. params (JsonProperty[]) The properties to be used as parameters to the annotated method, in order.

Examples

Construct this object using the constructor, with a single argument populated from JSON property "foo"

<?
/**
 * @JsonCreator({@JsonProperty(name="foo", type="string)})
 */
public function __construct($foo) {

Back to Annotations list

Clone this wiki locally