Class CompileTimeTypeInfo
- java.lang.Object
-
- picocli.codegen.annotation.processing.CompileTimeTypeInfo
-
- All Implemented Interfaces:
CommandLine.Model.ITypeInfo
class CompileTimeTypeInfo extends java.lang.Object implements CommandLine.Model.ITypeInfo
-
-
Field Summary
Fields Modifier and Type Field Description (package private) java.util.List<java.lang.String>
actualGenericTypeArguments
(package private) java.util.List<? extends javax.lang.model.type.TypeMirror>
auxTypeMirrors
(package private) boolean
isCollection
(package private) boolean
isMap
private static java.util.logging.Logger
logger
private static java.util.EnumSet<javax.lang.model.type.TypeKind>
PRIMITIVES
(package private) javax.lang.model.element.TypeElement
typeElement
(package private) javax.lang.model.type.TypeMirror
typeMirror
-
Constructor Summary
Constructors Constructor Description CompileTimeTypeInfo(javax.lang.model.type.TypeMirror asType)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private javax.lang.model.type.TypeMirror
createStringTypeMirror()
private static boolean
find(java.lang.String interfaceName, javax.lang.model.element.TypeElement typeElement)
private static boolean
find(java.lang.String interfaceName, javax.lang.model.element.TypeElement typeElement, java.util.Set<javax.lang.model.element.Element> visited)
java.util.List<java.lang.String>
getActualGenericTypeArguments()
Returns the names of the type arguments if this is a generic type.java.util.List<CommandLine.Model.ITypeInfo>
getAuxiliaryTypeInfos()
Returns type information of components or elements of amultivalue
type.java.lang.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.java.lang.String
getClassName()
Returns the fully qualified class name (not the canonical name, but with $-signs for inner classes) of the typeElement.java.lang.String
getClassSimpleName()
java.util.List<java.lang.String>
getEnumConstantNames()
java.lang.Class<?>
getType()
Returns the class that the option or parameter value should be converted to when matched on the command line.boolean
isArray()
boolean
isBoolean()
(package private) static boolean
isBooleanType(javax.lang.model.type.TypeMirror type)
boolean
isCollection()
boolean
isEnum()
Returnstrue
ifCommandLine.Model.ITypeInfo.getType()
is an enum.boolean
isMap()
boolean
isMultiValue()
Returnstrue
ifCommandLine.Model.ITypeInfo.getType()
is an array, map or collection.boolean
isOptional()
java.lang.String
toString()
-
-
-
Field Detail
-
logger
private static java.util.logging.Logger logger
-
PRIMITIVES
private static final java.util.EnumSet<javax.lang.model.type.TypeKind> PRIMITIVES
-
typeMirror
final javax.lang.model.type.TypeMirror typeMirror
-
auxTypeMirrors
final java.util.List<? extends javax.lang.model.type.TypeMirror> auxTypeMirrors
-
actualGenericTypeArguments
final java.util.List<java.lang.String> actualGenericTypeArguments
-
typeElement
final javax.lang.model.element.TypeElement typeElement
-
isCollection
final boolean isCollection
-
isMap
final boolean isMap
-
-
Method Detail
-
createStringTypeMirror
private javax.lang.model.type.TypeMirror createStringTypeMirror()
-
find
private static boolean find(java.lang.String interfaceName, javax.lang.model.element.TypeElement typeElement)
-
find
private static boolean find(java.lang.String interfaceName, javax.lang.model.element.TypeElement typeElement, java.util.Set<javax.lang.model.element.Element> visited)
-
getAuxiliaryTypeInfos
public java.util.List<CommandLine.Model.ITypeInfo> getAuxiliaryTypeInfos()
Description copied from interface:CommandLine.Model.ITypeInfo
Returns type information of components or elements of amultivalue
type.- Specified by:
getAuxiliaryTypeInfos
in interfaceCommandLine.Model.ITypeInfo
-
getActualGenericTypeArguments
public java.util.List<java.lang.String> getActualGenericTypeArguments()
Description copied from interface:CommandLine.Model.ITypeInfo
Returns the names of the type arguments if this is a generic type. For example, returns["java.lang.String"]
if this type isList<String>
.- Specified by:
getActualGenericTypeArguments
in interfaceCommandLine.Model.ITypeInfo
-
isBoolean
public boolean isBoolean()
Description copied from interface:CommandLine.Model.ITypeInfo
- Specified by:
isBoolean
in interfaceCommandLine.Model.ITypeInfo
-
isBooleanType
static boolean isBooleanType(javax.lang.model.type.TypeMirror type)
-
isOptional
public boolean isOptional()
Description copied from interface:CommandLine.Model.ITypeInfo
- Specified by:
isOptional
in interfaceCommandLine.Model.ITypeInfo
-
isMultiValue
public boolean isMultiValue()
Description copied from interface:CommandLine.Model.ITypeInfo
Returnstrue
ifCommandLine.Model.ITypeInfo.getType()
is an array, map or collection.- Specified by:
isMultiValue
in interfaceCommandLine.Model.ITypeInfo
-
isArray
public boolean isArray()
- Specified by:
isArray
in interfaceCommandLine.Model.ITypeInfo
-
isCollection
public boolean isCollection()
- Specified by:
isCollection
in interfaceCommandLine.Model.ITypeInfo
-
isMap
public boolean isMap()
- Specified by:
isMap
in interfaceCommandLine.Model.ITypeInfo
-
isEnum
public boolean isEnum()
Description copied from interface:CommandLine.Model.ITypeInfo
Returnstrue
ifCommandLine.Model.ITypeInfo.getType()
is an enum.- Specified by:
isEnum
in interfaceCommandLine.Model.ITypeInfo
-
getEnumConstantNames
public java.util.List<java.lang.String> getEnumConstantNames()
- Specified by:
getEnumConstantNames
in interfaceCommandLine.Model.ITypeInfo
-
getClassName
public java.lang.String getClassName()
Returns the fully qualified class name (not the canonical name, but with $-signs for inner classes) of the typeElement. If only a typeMirror is available, this method falls back to TypeMirror.toString, which returns the canonical name.- Specified by:
getClassName
in interfaceCommandLine.Model.ITypeInfo
- Returns:
- the fully qualified class name of the type
-
getClassSimpleName
public java.lang.String getClassSimpleName()
- Specified by:
getClassSimpleName
in interfaceCommandLine.Model.ITypeInfo
-
getType
public java.lang.Class<?> getType()
Description copied from interface:CommandLine.Model.ITypeInfo
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.- Specified by:
getType
in interfaceCommandLine.Model.ITypeInfo
- Returns:
- the class that the option or parameter value should be converted to
-
getAuxiliaryTypes
public java.lang.Class<?>[] getAuxiliaryTypes()
Description copied from interface:CommandLine.Model.ITypeInfo
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.- Specified by:
getAuxiliaryTypes
in interfaceCommandLine.Model.ITypeInfo
- Returns:
- the component type or types of an array, Collection or Map type
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-