Merge "Cleanup: Removed unused code"
[controller.git] / opendaylight / netconf / netconf-cli / src / main / java / org / opendaylight / controller / netconf / cli / reader / impl / LeafListEntryReader.java
1 /*
2  * Copyright (c) 2014 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.netconf.cli.reader.impl;
9
10 import com.google.common.base.Optional;
11 import com.google.common.collect.Lists;
12 import java.util.List;
13 import jline.console.completer.Completer;
14 import org.opendaylight.controller.netconf.cli.io.BaseConsoleContext;
15 import org.opendaylight.controller.netconf.cli.io.ConsoleContext;
16 import org.opendaylight.controller.netconf.cli.io.ConsoleIO;
17 import org.opendaylight.controller.netconf.cli.reader.GenericListEntryReader;
18 import org.opendaylight.yangtools.yang.model.api.LeafListSchemaNode;
19 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
20 import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
21
22 class LeafListEntryReader extends BasicDataHolderReader<LeafListSchemaNode> implements
23         GenericListEntryReader<LeafListSchemaNode> {
24
25     public LeafListEntryReader(final ConsoleIO console, final SchemaContext schemaContext) {
26         super(console, schemaContext);
27     }
28
29     public LeafListEntryReader(final ConsoleIO console, final SchemaContext schemaContext, final boolean readConfigNode) {
30         super(console, schemaContext, readConfigNode);
31     }
32
33     @Override
34     protected TypeDefinition<?> getType(final LeafListSchemaNode schemaNode) {
35         return schemaNode.getType();
36     }
37
38     @Override
39     protected ConsoleContext getContext(final LeafListSchemaNode schemaNode) {
40         return new BaseConsoleContext<LeafListSchemaNode>(schemaNode) {
41
42             @Override
43             public Optional<String> getPrompt() {
44                 return Optional.of("[entry]");
45             }
46
47             @Override
48             protected List<Completer> getAdditionalCompleters() {
49                 return Lists.<Completer> newArrayList(getBaseCompleter(getDataSchemaNode()));
50             }
51         };
52     }
53 }