[jboss-dev-forums] [Design of Management Features on JBoss] - Re: JBAS-6672, null values and defaults

ips do-not-reply at jboss.com
Thu Apr 2 11:52:03 EDT 2009


In the RHQ config GUI, we don't make a distinction between null values and unspecified/removed values; I think we figured that 99% of the time calling setValue(null) on n underlying managed resource would be equivalent to not calling the setter at all. That said, I can understand you wanting to make the distinction just to support all possible use cases, and the API you describe will work just fine for us. A few questions:

1) Will:

managedComponent.getProperties().remove("foo")

be semantically equivalent to:

managedComponent.getProperty("foo").setRemoved(true)

? (I think it should be)

2) Will managementView.updateComponent() throw an Exception if for a property (managedProperty.isMandatory() && managedProperty.isRemoved()) is true? I think it should, because not specifying a value for a mandatory property should be considered a client error. The other option would be having setRemoved(true) throw an Exception if the prop is mandatory.

3) I think primitive SimpleValues should not be allowed to have a value of null. They are primitive after all. Either updateComponent() could throw an Excpetion, or, to nip it in the bud, the impl of setValue() in SimpleValueSupport could be changed to:

   public void setValue(Serializable value)
  |    {
  |       if (value == null && this.metatype.isPrimitive())
  |           throw new IllegalArgumentException("Primitive SimpleValues cannot have a value of null.");
  |       this.value = value;
  |    }


View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4223065#4223065

Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4223065



More information about the jboss-dev-forums mailing list