[weld-issues] [JBoss JIRA] Commented: (WELDX-178) Add isMetadataChanged() accessor to AnnotatedTypeBuilder

Dan Allen (JIRA) jira-events at lists.jboss.org
Mon Oct 18 17:40:54 EDT 2010


    [ https://jira.jboss.org/browse/WELDX-178?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12557707#action_12557707 ] 

Dan Allen commented on WELDX-178:
---------------------------------

By the same token, I think that AnnotatedTypeBuilder should be as lazy as possible with loading it's internal state. It should only build up the model as the type is changed, possibly as late as create(). There's no question this API will be used heavily by extension writers and therefore it should try to be as efficient as possible to avoid slowing down the deployment. 

> Add isMetadataChanged() accessor to AnnotatedTypeBuilder
> --------------------------------------------------------
>
>                 Key: WELDX-178
>                 URL: https://jira.jboss.org/browse/WELDX-178
>             Project: Weld Extensions
>          Issue Type: Feature Request
>    Affects Versions: 1.0.0.Beta1
>            Reporter: Dan Allen
>            Priority: Minor
>             Fix For: 1.0.0.Beta2
>
>
> As an optimization, it makes sense to only create the AnnotatedType and assign it to ProcessAnnotatedType if the metadata has changed in anyway. Otherwise, you are wrapping the type just for the sake of wrapping it.
> Therefore, I propose that any change to the state of the annotated type be tracked by a changed flag that is accessible by calling the AnnotatedTypeBuilder#isMetadataChanged() (or similarly named) method. It would be used as follows:
> AnnotatedTypeBuilder b = AnnotatedTypeBuilder.readFromType(event.getAnnotatedType(), true);
> // do extension logic
> if (b.isMetadataChanged())
> {
>    event.setAnnotatedType(b.create());
> }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the weld-issues mailing list