Skip to content

Package io.github.qishr.cascara.common.util

Interface ITypeInfo

java.lang.Object
        io.github.qishr.cascara.common.util.CommandLine.Model.ITypeInfo

Enclosing Class:
    io.github.qishr.cascara.common.util.CommandLine.Model


public static interface ITypeInfo

Encapculates type information for an option or parameter to make this information available both at runtime and at compile time (when Class values are not available).Most of the methods in this interface (but not all!) are safe to use by annotation processors.

Method Summary

Modifier and Type Method Description
public abstract boolean isBoolean() Returns true if getType.getType is boolean or java.lang.Boolean.
public abstract boolean isMultiValue() Returns true if getType.getType is an array, map or collection.
public abstract boolean isOptional() Returns true if getType.getType is java.util.Optional
public abstract boolean isArray() Returns true if this type is an array multi-value type.
public abstract boolean isCollection()
public abstract boolean isMap()
public abstract boolean isEnum() Returns true if getType.getType is an enum.
public abstract List<String> getEnumConstantNames()
public abstract String getClassName()
public abstract String getClassSimpleName()
public abstract List<ITypeInfo> getAuxiliaryTypeInfos() Returns type information of components or elements of a isMultiValue.isMultiValue type.
public abstract List<String> getActualGenericTypeArguments() Returns the names of the type arguments if this is a generic type.
public abstract Class<?> getType() Returns the class that the option or parameter value should be converted to when matched on the command line.
public abstract Class<?>[] getAuxiliaryTypes() Returns the component class of an array, or the parameter type of a generic Collection, or the parameter types of the key and the value of a generic Map.

Method Details

isBoolean

public abstract boolean isBoolean()

Returns true if getType.getType is boolean or java.lang.Boolean.


isMultiValue

public abstract boolean isMultiValue()

Returns true if getType.getType is an array, map or collection.Note that from picocli 4.7, char[] arrays are considered single values (similar to String) and are not treated as arrays.


isOptional

public abstract boolean isOptional()

Returns true if getType.getType is java.util.Optional

Since:

4.6


isArray

public abstract boolean isArray()

Returns true if this type is an array multi-value type.Note that from picocli 4.7, char[] arrays are considered single values (similar to String) and are not treated as arrays.


isCollection

public abstract boolean isCollection()


isMap

public abstract boolean isMap()


isEnum

public abstract boolean isEnum()

Returns true if getType.getType is an enum.


getEnumConstantNames

public abstract List<String> getEnumConstantNames()


getClassName

public abstract String getClassName()


getClassSimpleName

public abstract String getClassSimpleName()


getAuxiliaryTypeInfos

public abstract List<ITypeInfo> getAuxiliaryTypeInfos()

Returns type information of components or elements of a isMultiValue.isMultiValue type.


getActualGenericTypeArguments

public abstract List<String> getActualGenericTypeArguments()

Returns the names of the type arguments if this is a generic type.For example, returns ["java.lang.String"] if this type is List<String>.


getType

public abstract Class<?> getType()

Returns the class that the option or parameter value should be converted to when matched on the command line.This method is not safe for annotation processors to use.

Returns:

the class that the option or parameter value should be converted to


getAuxiliaryTypes

public abstract Class<?>[] getAuxiliaryTypes()

Returns the component class of an array, or the parameter type of a generic Collection, or the parameter types of the key and the value of a generic Map.This method is not safe for annotation processors to use.

Returns:

the component type or types of an array, Collection or Map type