001/*
002 * Copyright 2012-2014 the original author or authors.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *      http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016
017package org.springframework.boot.cli.command;
018
019import java.util.Collection;
020import java.util.Collections;
021
022import org.springframework.boot.cli.command.options.OptionHelp;
023
024/**
025 * Abstract {@link Command} implementation.
026 *
027 * @author Phillip Webb
028 * @author Dave Syer
029 */
030public abstract class AbstractCommand implements Command {
031
032        private final String name;
033
034        private final String description;
035
036        /**
037         * Create a new {@link AbstractCommand} instance.
038         * @param name the name of the command
039         * @param description the command description
040         */
041        protected AbstractCommand(String name, String description) {
042                this.name = name;
043                this.description = description;
044        }
045
046        @Override
047        public String getName() {
048                return this.name;
049        }
050
051        @Override
052        public String getDescription() {
053                return this.description;
054        }
055
056        @Override
057        public String getUsageHelp() {
058                return null;
059        }
060
061        @Override
062        public String getHelp() {
063                return null;
064        }
065
066        @Override
067        public Collection<OptionHelp> getOptionsHelp() {
068                return Collections.emptyList();
069        }
070
071        @Override
072        public Collection<HelpExample> getExamples() {
073                return null;
074        }
075
076}