[
http://issues.apache.org/jira/browse/BEEHIVE-179?page=comments#action_57782 ]
Kyle Marvin commented on BEEHIVE-179:
-------------------------------------
This is wrapped up in the following commented out code, from the impl of
org.apache.beehive.controls.runtime.bean.ControlBeanContext.getControlPropertySet():
// TODO: Add a PropertySet meta-attribute that indicates the
PropertySet is optional.
// This implies: a) no getters/setters, and b) the PropertySet can
appear to be
// 'null' from the impl perspective if unset; otherwise, a PropertySet
containing all
// default values will be returned.
//if (!map.containsPropertySet(propertySet))
// return null;
If a PropertySet/annotation is optional, then we can't really generate the
client-visible getter for it. There is no way to express an unset value,
unless it is the default. If the impl isn't using defaulted semantics, it
seems wrong to tell the client that the default is the property value. I
feel pretty strongly that client/impl views of property state must be identical.
Similarly, if 'unset' is a valid value for the property, there would need to be
a way to 'unset' a property, which again doesn't make sense using the standard
JavaBeans accessor model.
So the proposed resolution would be to add an 'optional' boolean attribute to
the PropertySet annotation type, which has the semantics described in the
comment above.
> context.getControlPropertySet() should return null for non-existent annotation
> ------------------------------------------------------------------------------
>
> Key: BEEHIVE-179
> URL: http://issues.apache.org/jira/browse/BEEHIVE-179
> Project: Beehive
> Type: Bug
> Components: Controls
> Versions: V1Beta
> Environment: Windows
> Reporter: Lawrence Jones
> Priority: Critical
>
> I call
> ServiceControl.TypesJarName typesJarNameAnn =
> (ServiceControl.TypesJarName)context.
> getControlPropertySet(ServiceControl.TypesJarName.class);
> in the Impl of my control (ServiceControl). TypesJarName is a valid
> annotation which is defined in the public interface but not used in either
> the public interface nor in the JCX.
> I expected to receive null but instead I get a non-null object with defaulted
> values for its members.
> This is at odds with the javadoc for the API
> ControlBeanContext.getControlPropertySet() and in any case you need a way to
> be able to tell whether an annotation is present or not (especially if you
> have marker annotations).
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
http://www.atlassian.com/software/jira