All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.enonic.xp.node.NodesHasChildrenResult Maven / Gradle / Ivy

There is a newer version: 7.14.4
Show newest version
package com.enonic.xp.node;

import java.util.HashMap;
import java.util.Map;

import com.google.common.collect.ImmutableMap;

@Deprecated
public class NodesHasChildrenResult
{
    private final ImmutableMap valueMap;

    public NodesHasChildrenResult( final Builder builder )
    {
        this.valueMap = ImmutableMap.copyOf( builder.valueMap );
    }

    private NodesHasChildrenResult()
    {
        this.valueMap = ImmutableMap.of();
    }

    public static NodesHasChildrenResult empty()
    {
        return new NodesHasChildrenResult();
    }

    public boolean hasChild( final NodeId nodeId )
    {
        return this.valueMap.get( nodeId ) != null ? this.valueMap.get( nodeId ) : false;
    }

    public static Builder create()
    {
        return new Builder();
    }

    public static class Builder
    {
        private final Map valueMap = new HashMap<>();

        public Builder add( final NodeId nodeId, final boolean hasChild )
        {
            this.valueMap.put( nodeId, hasChild );
            return this;
        }

        public NodesHasChildrenResult build()
        {
            return new NodesHasChildrenResult( this );
        }
    }


}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy