-
Enhancement
-
Resolution: Done
-
Major
-
None
-
None
It would be nice if you could do this:
for (ModelNode ref : PROXIES.resolveModelAttribute(context, model).asListOrEmpty()) { String asString = ref.asString(); this.outboundSocketBindings.add(new InjectedValueDependency<>(CommonUnaryRequirement.OUTBOUND_SOCKET_BINDING.getServiceName(context, asString), OutboundSocketBinding.class)); }
instead of this:
ModelNode node = PROXIES.resolveModelAttribute(context, model); if (node.isDefined()) for (ModelNode ref : node.asList()) { String asString = ref.asString(); this.outboundSocketBindings.add(new InjectedValueDependency<>(CommonUnaryRequirement.OUTBOUND_SOCKET_BINDING.getServiceName(context, asString), OutboundSocketBinding.class)); }
The asListOrEmpty method would return a Collections.emptyList() if the value is undefined, similarly to the existing asStringOrNull and related methods.