-
Notifications
You must be signed in to change notification settings - Fork 12
@JsonAnyGetter
JonathanO edited this page Oct 14, 2012
·
3 revisions
A method annotated with this is expected to return an array of key-values to add to the result of serializing the object. It must take exactly 0 parameters.
There can only be one @JsonAnyGetter per class.
This is very commonly used with @JsonAnySetter
There aren't any.
class Foo {
private $anyStuff = array();
/**
* @JsonAnySetter
*/
function amSetter($key, $value) {
$this->anyStuff[$key] = $value;
}
/**
* @JsonAnyGetter
*/
function getStuff() {
return $this->anyStuff;
}
}