Skip to content
Jonathan Oddy edited this page Mar 5, 2014 · 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 two arguments populated from JSON property "foo" and "bar", respectively.

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

Back to Annotations list

Clone this wiki locally