Hi,

I've implemented this and put the result in the branch
feature-execution-context-metadata.   Please review it and let me know
what you think.

https://github.com/xwiki/xwiki-commons/commit/093366f7396e95ca6d71fbf6df0c6d63be1ac28b

Best Regards,

/Andreas

2012-10-12 09:27, Andreas Jonsson skrev:
> Hi everyone,
>
> I would like to propose to introduce a possibility to associate
> properties in the execution context with metadata by declaring them.  We
> introduce the class 'ExecutionContextProperty' that will store the
> metadata attributes, in addition to the actual property value.
>
>   /**
>    * Declare a property in the execution context.
>    *
>    * @param key The key that names the property
>    * @param property The property to declare.
>    */
>   public void declareProperty(String key, ExecutionContextProperty property)
>
> The metadata governs how the property should be treated when managing
> the execution contexts.  For instance, these attributes could be supported:
>
> * Read-only  - The value may not be updated within the the execution
> context.
>
> * Inherited  - The property will be inherited from the current context
> when replacing the execution context within the scope of a request.
>
> * Clone      - Also clone the value when the execution context is cloned.
>
> * Type       - The class of the value, for typechecking when replacing
> the value.
>
> * Non-null   - The value may not be null
>
> So, the arguments for this proposal are at least two:
>
> 1. Catch errors early and simplify debugging.
>
> 2. Convenience of having properties automatically maintained across
> execution contexts within the same request cycle.
>
> What do you think?
>
> I would like to implement and merge this ASAP.
>
>
> Best Regards,
>
> /Andreas
>

_______________________________________________
devs mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/devs

Reply via email to