setField

Synopsis

setField(^Class|$object, field => value, ...)

Sets any number of public/protected fields of the specified class or instance of $object to their corresponding values.

Parameters

^Class - a literal of the class to set a static field for.

$object - an instance of a class to set a field for.

field => value - an arbitrary field name followed by a corresponding value which is converted to the type Java expects.

... - the field => value parameter can be repeated any number of times with more values to set.

Side Effects / Notes

Errors

Examples

import java.awt.Point; $p = [new Point]; setField($p, x => 33, y => 45); println($p);

java.awt.Point[x=33,y=45]