- class
Class that the property must be an instance of.
See as_class() for details.
- getter
An optional function used to get the value. The function
should take self as its sole argument and return the value. If you
supply a getter, you are responsible for ensuring that it returns
an object of the correct class; it will not be validated automatically.
If a property has a getter but doesn't have a setter, it is read only.
- setter
An optional function used to set the value. The function
should take self and value and return a modified object.
- validator
A function taking a single argument, value, the value
to validate.
The job of a validator is to determine whether the property value is valid.
It should return NULL if the object is valid, or if it's not valid,
a single string describing the problem. The message should not include the
name of the property as this will be automatically appended to the
beginning of the message.
The validator will be called after the class has been verified, so
your code can assume that value has known type.
- default
When an object is created and the property is not supplied,
what should it default to? If NULL, it defaults to the "empty" instance
of class. This can also be a quoted call, which then becomes a standard
function promise in the default constructor, evaluated at the time the
object is constructed.
- name
Property name, primarily used for error messages. Generally
don't need to set this here, as it's more convenient to supply as
the element name when defining a list of properties. If both name
and a list-name are supplied, the list-name will be used.