Do not use Optional in NormalizedNodeWrapper
[controller.git] / opendaylight / md-sal / sal-clustering-commons / src / main / java / org / opendaylight / controller / cluster / datastore / node / utils / transformer / NormalizedNodeBuilderWrapper.java
1 /*
2  * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
3  *
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
7  */
8 package org.opendaylight.controller.cluster.datastore.node.utils.transformer;
9
10 import static java.util.Objects.requireNonNull;
11
12 import org.eclipse.jdt.annotation.Nullable;
13 import org.opendaylight.yangtools.yang.common.QName;
14 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
15 import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.NormalizedNodeContainerBuilder;
16 import org.opendaylight.yangtools.yang.data.util.DataSchemaContextNode;
17
18 final class NormalizedNodeBuilderWrapper {
19     private final NormalizedNodeContainerBuilder<?, ?, ?, ?> builder;
20     private final PathArgument identifier;
21     private final DataSchemaContextNode<?> schemaNode;
22
23     NormalizedNodeBuilderWrapper(final NormalizedNodeContainerBuilder<?, ?, ?, ?> builder,
24             final PathArgument identifier, final @Nullable DataSchemaContextNode<?> schemaNode) {
25         this.builder = requireNonNull(builder);
26         this.identifier = requireNonNull(identifier);
27         this.schemaNode = schemaNode;
28     }
29
30     @SuppressWarnings("rawtypes")
31     NormalizedNodeContainerBuilder builder() {
32         return builder;
33     }
34
35     QName nodeType() {
36         return identifier.getNodeType();
37     }
38
39     PathArgument identifier() {
40         return identifier;
41     }
42
43     @Nullable DataSchemaContextNode<?> getSchema() {
44         return schemaNode;
45     }
46 }