org.crsh.cmdline.ParameterDescriptor Maven / Gradle / Ivy
/*
* Copyright (C) 2010 eXo Platform SAS.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.crsh.cmdline;
import org.crsh.cmdline.binding.TypeBinding;
import org.crsh.cmdline.completers.EmptyCompleter;
import org.crsh.cmdline.matcher.CmdSyntaxException;
import org.crsh.cmdline.spi.Completer;
import org.crsh.cmdline.spi.Value;
import java.io.IOException;
import java.lang.annotation.Annotation;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.util.List;
/**
* @author Julien Viet
* @version $Revision$
*/
public abstract class ParameterDescriptor {
/** . */
private final B binding;
/** . */
private final Description description;
/** . */
private final SimpleValueType type;
/** . */
private final Multiplicity multiplicity;
/** . */
private final boolean required;
/** . */
private final boolean password;
/** . */
private final Type javaType;
/** . */
private final Class> javaValueType;
/** . */
private final Class extends Completer> completerType;
/** The annotation when it exists. */
private final Annotation annotation;
/** . */
private final boolean unquote;
/** . */
CommandDescriptor, B> owner;
public ParameterDescriptor(
B binding,
Type javaType,
Description description,
boolean required,
boolean password,
boolean unquote,
Class extends Completer> completerType,
Annotation annotation) throws IllegalValueTypeException, IllegalParameterException {
//
Class> javaValueType;
Multiplicity multiplicity;
if (javaType instanceof Class>) {
javaValueType = (Class