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 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 import java.util.List;
24 class LeafListEntryReader extends BasicDataHolderReader<LeafListSchemaNode> implements
25 GenericListEntryReader<LeafListSchemaNode> {
27 public LeafListEntryReader(final ConsoleIO console, final SchemaContext schemaContext) {
28 super(console, schemaContext);
31 public LeafListEntryReader(final ConsoleIO console, final SchemaContext schemaContext, final boolean readConfigNode) {
32 super(console, schemaContext, readConfigNode);
36 protected TypeDefinition<?> getType(final LeafListSchemaNode schemaNode) {
37 return schemaNode.getType();
41 protected ConsoleContext getContext(final LeafListSchemaNode schemaNode) {
42 return new BaseConsoleContext<LeafListSchemaNode>(schemaNode) {
45 public Optional<String> getPrompt() {
46 return Optional.of("[entry]");
50 protected List<Completer> getAdditionalCompleters() {
51 return Lists.<Completer> newArrayList(getBaseCompleter(getDataSchemaNode()));