3 * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
5 * This program and the accompanying materials are made available under the
6 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
7 * and is available at http://www.eclipse.org/legal/epl-v10.html
9 package org.opendaylight.controller.netconf.cli.reader.impl;
11 import com.google.common.base.Optional;
12 import com.google.common.collect.Lists;
13 import java.util.List;
14 import jline.console.completer.Completer;
15 import org.opendaylight.controller.netconf.cli.io.BaseConsoleContext;
16 import org.opendaylight.controller.netconf.cli.io.ConsoleContext;
17 import org.opendaylight.controller.netconf.cli.io.ConsoleIO;
18 import org.opendaylight.controller.netconf.cli.reader.GenericListEntryReader;
19 import org.opendaylight.yangtools.yang.model.api.LeafListSchemaNode;
20 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
21 import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
23 class LeafListEntryReader extends BasicDataHolderReader<LeafListSchemaNode> implements
24 GenericListEntryReader<LeafListSchemaNode> {
26 public LeafListEntryReader(final ConsoleIO console, final SchemaContext schemaContext) {
27 super(console, schemaContext);
30 public LeafListEntryReader(final ConsoleIO console, final SchemaContext schemaContext, final boolean readConfigNode) {
31 super(console, schemaContext, readConfigNode);
35 protected TypeDefinition<?> getType(final LeafListSchemaNode schemaNode) {
36 return schemaNode.getType();
40 protected ConsoleContext getContext(final LeafListSchemaNode schemaNode) {
41 return new BaseConsoleContext<LeafListSchemaNode>(schemaNode) {
44 public Optional<String> getPrompt() {
45 return Optional.of("[entry]");
49 protected List<Completer> getAdditionalCompleters() {
50 return Lists.<Completer> newArrayList(getBaseCompleter(getDataSchemaNode()));