-
Notifications
You must be signed in to change notification settings - Fork 12
@JsonCreator
Jonathan Oddy edited this page Mar 5, 2014
·
5 revisions
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.
- params (JsonProperty[]) The properties to be used as parameters to the annotated method, in order.
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) {