2 * Copyright (c) 2014 Cisco Systems, Inc. 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.controller.netconf.cli.reader.impl;
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;
22 class LeafListEntryReader extends BasicDataHolderReader<LeafListSchemaNode> implements
23 GenericListEntryReader<LeafListSchemaNode> {
25 public LeafListEntryReader(final ConsoleIO console, final SchemaContext schemaContext) {
26 super(console, schemaContext);
29 public LeafListEntryReader(final ConsoleIO console, final SchemaContext schemaContext, final boolean readConfigNode) {
30 super(console, schemaContext, readConfigNode);
34 protected TypeDefinition<?> getType(final LeafListSchemaNode schemaNode) {
35 return schemaNode.getType();
39 protected ConsoleContext getContext(final LeafListSchemaNode schemaNode) {
40 return new BaseConsoleContext<LeafListSchemaNode>(schemaNode) {
43 public Optional<String> getPrompt() {
44 return Optional.of("[entry]");
48 protected List<Completer> getAdditionalCompleters() {
49 return Lists.<Completer> newArrayList(getBaseCompleter(getDataSchemaNode()));