/* * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v1.0 which accompanies this distribution, * and is available at http://www.eclipse.org/legal/epl-v10.html */ package org.opendaylight.controller.yang.parser.builder.api; import java.util.HashSet; import java.util.Set; import org.opendaylight.controller.yang.common.QName; import org.opendaylight.controller.yang.model.api.DataSchemaNode; import org.opendaylight.controller.yang.model.api.GroupingDefinition; public abstract class AbstractDataNodeContainerBuilder implements DataNodeContainerBuilder { private final QName qname; protected Set childNodes; protected final Set addedChildNodes = new HashSet(); protected Set groupings; protected final Set addedGroupings = new HashSet(); protected AbstractDataNodeContainerBuilder(QName qname) { this.qname = qname; } @Override public QName getQName() { return qname; } @Override public Set getChildNodes() { return addedChildNodes; } @Override public void addChildNode(DataSchemaNodeBuilder childNode) { addedChildNodes.add(childNode); } public void setChildNodes(Set childNodes) { this.childNodes = childNodes; } public Set getGroupings() { return addedGroupings; } @Override public void addGrouping(GroupingBuilder grouping) { addedGroupings.add(grouping); } public void setGroupings(final Set groupings) { this.groupings = groupings; } }