You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pivot.apache.org by "Appddevvv (JIRA)" <ji...@apache.org> on 2010/06/18 21:59:23 UTC

[jira] Commented: (PIVOT-527) add getCurrentElement() to WTKXSerializer

    [ https://issues.apache.org/jira/browse/PIVOT-527?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12880302#action_12880302 ] 

Appddevvv commented on PIVOT-527:
---------------------------------

If you do not provide the element.parent.value directly as in getEnclosingObject(), then you have to navigate the Element in the subclass. The Element static class will need to be made protected versus static.

> add getCurrentElement() to WTKXSerializer
> -----------------------------------------
>
>                 Key: PIVOT-527
>                 URL: https://issues.apache.org/jira/browse/PIVOT-527
>             Project: Pivot
>          Issue Type: Improvement
>          Components: wtk
>            Reporter: Appddevvv
>            Priority: Minor
>             Fix For: 1.5.1
>
>
> When using new capability in PIVOT-514, sometimes you need to get the enclosing object. While this could be added to the createInstance method, you can also add it as a protected method. The code is below:
>  /**
>      * Return the enclosing object which is this element's parent's value.
>      * @return
>      */
>     protected Object getEnclosingObject() {
>       return element.parent==null?null:element.parent.value;
>     }
> This allows extensions of the serializer to know what the enclosing object is. From there, the tree can be climbed back to the root.
> It is possible to make instance creation a strategy design pattern, but the subclassing approach is sufficient for now but there are not strong use-cases supporting it.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.