On 9/3/15 6:06 AM, Darran Lofthouse wrote:
On 26/08/15 20:19, Brian Stansberry wrote:
> You can replace this:
>
> for (Property prop : node.asPropertyList() {
> String name = prop.getName();
> ModelNode value = prop.getValue();
> ... do something with name and value
> }
>
> with
>
> for (String name : node.keys()) {
> ModelNode value = node.get(name);
For this line would it be better to use 'require'? It should not be
possible for it to be undefined but require would check that.
There's no requirement that 'value' not be ModelType.UNDEFINED, and the
'require' method doesn't introduce one either. So calling 'require'
would just be a confirmation that 'keys()' isn't broken.
ModelNode.asPropertyList() also (correctly) doesn't include any checks
that the values in the properties are defined.
--
Brian Stansberry
Senior Principal Software Engineer
JBoss by Red Hat