You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-dev@jackrabbit.apache.org by Jukka Zitting <ju...@gmail.com> on 2014/02/21 18:27:31 UTC

Re: svn commit: r1570199 - in /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak: core/HiddenTree.java core/MutableTree.java plugins/tree/AbstractTree.java plugins/tree/ImmutableTree.java

Hi,

On Thu, Feb 20, 2014 at 9:15 AM,  <md...@apache.org> wrote:
> +    @Override
> +    public String toString() {
> +        return getPath() + ": " + toString(getNodeState());
> +    }
> +
> +    protected String toString(NodeState nodeState) {

Given that the intention is to avoid exposing in toString() details
that are not accessible through other methods, it would seem cleaner
to implement it in terms of the publicly accessible methods:

    for (PropertyState p : getProperties()) {
        sb.append(' ').append(p).append(',');
    }
    for (String name : getChildNames()) {
        sb.append(' ').append(name).append( " = { ... },");
    }

Otherwise it'll pretty easy to forget to update the toString() method
in case we make some changes in the way hidden content is handled.

BR,

Jukka Zitting

Re: svn commit: r1570199 - in /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak: core/HiddenTree.java core/MutableTree.java plugins/tree/AbstractTree.java plugins/tree/ImmutableTree.java

Posted by Michael Dürig <md...@apache.org>.

On 21.2.14 6:27 , Jukka Zitting wrote:
> Given that the intention is to avoid exposing in toString() details
> that are not accessible through other methods, it would seem cleaner
> to implement it in terms of the publicly accessible methods:

Good point. See http://svn.apache.org/r1571194

Micha