/* * 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.yangtools.yang.data.impl.schema.builder.impl; import com.google.common.base.Preconditions; import java.util.Map; import java.util.Objects; import org.opendaylight.yangtools.yang.common.QName; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; import org.opendaylight.yangtools.yang.data.api.schema.LeafSetEntryNode; import org.opendaylight.yangtools.yang.data.impl.schema.nodes.AbstractImmutableNormalizedValueAttrNode; public class ImmutableLeafSetEntryNodeBuilder extends AbstractImmutableNormalizedNodeBuilder> { public static ImmutableLeafSetEntryNodeBuilder create() { return new ImmutableLeafSetEntryNodeBuilder<>(); } @Override public LeafSetEntryNode build() { return new ImmutableLeafSetEntryNode<>(getNodeIdentifier(), getValue(), getAttributes()); } private static final class ImmutableLeafSetEntryNode extends AbstractImmutableNormalizedValueAttrNode implements LeafSetEntryNode { ImmutableLeafSetEntryNode(final YangInstanceIdentifier.NodeWithValue nodeIdentifier, final T value, final Map attributes) { super(nodeIdentifier, value, attributes); Preconditions.checkArgument(Objects.deepEquals(nodeIdentifier.getValue(), value), "Node identifier contains different value: %s than value itself: %s", nodeIdentifier, value); } } }