2 * Copyright (c) 2015 Pantheon Technologies s.r.o. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.yangtools.yang.model.ri.type;
10 import static com.google.common.base.Preconditions.checkState;
11 import static java.util.Objects.requireNonNull;
13 import org.eclipse.jdt.annotation.NonNull;
14 import org.opendaylight.yangtools.yang.common.QName;
15 import org.opendaylight.yangtools.yang.model.api.PathExpression;
16 import org.opendaylight.yangtools.yang.model.api.type.LeafrefTypeDefinition;
18 public final class LeafrefTypeBuilder extends RequireInstanceRestrictedTypeBuilder<LeafrefTypeDefinition> {
19 private PathExpression pathStatement;
21 LeafrefTypeBuilder(final QName qname) {
25 public LeafrefTypeBuilder setPathStatement(final @NonNull PathExpression pathStatement) {
26 checkState(this.pathStatement == null, "Path statement already set to %s", this.pathStatement);
27 this.pathStatement = requireNonNull(pathStatement);
32 LeafrefTypeDefinition buildType() {
33 return new BaseLeafrefType(getQName(), pathStatement, getRequireInstance(), getUnknownSchemaNodes());