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) booleanisCollection(package private) booleanisMapprivate static java.util.logging.Loggerloggerprivate static java.util.EnumSet<javax.lang.model.type.TypeKind>PRIMITIVES(package private) javax.lang.model.element.TypeElementtypeElement(package private) javax.lang.model.type.TypeMirrortypeMirror
-
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.TypeMirrorcreateStringTypeMirror()private static booleanfind(java.lang.String interfaceName, javax.lang.model.element.TypeElement typeElement)private static booleanfind(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 amultivaluetype.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.StringgetClassName()Returns the fully qualified class name (not the canonical name, but with $-signs for inner classes) of the typeElement.java.lang.StringgetClassSimpleName()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.booleanisArray()booleanisBoolean()(package private) static booleanisBooleanType(javax.lang.model.type.TypeMirror type)booleanisCollection()booleanisEnum()ReturnstrueifCommandLine.Model.ITypeInfo.getType()is an enum.booleanisMap()booleanisMultiValue()ReturnstrueifCommandLine.Model.ITypeInfo.getType()is an array, map or collection.booleanisOptional()java.lang.StringtoString()
-
-
-
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.ITypeInfoReturns type information of components or elements of amultivaluetype.- Specified by:
getAuxiliaryTypeInfosin interfaceCommandLine.Model.ITypeInfo
-
getActualGenericTypeArguments
public java.util.List<java.lang.String> getActualGenericTypeArguments()
Description copied from interface:CommandLine.Model.ITypeInfoReturns 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:
getActualGenericTypeArgumentsin interfaceCommandLine.Model.ITypeInfo
-
isBoolean
public boolean isBoolean()
Description copied from interface:CommandLine.Model.ITypeInfo- Specified by:
isBooleanin 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:
isOptionalin interfaceCommandLine.Model.ITypeInfo
-
isMultiValue
public boolean isMultiValue()
Description copied from interface:CommandLine.Model.ITypeInfoReturnstrueifCommandLine.Model.ITypeInfo.getType()is an array, map or collection.- Specified by:
isMultiValuein interfaceCommandLine.Model.ITypeInfo
-
isArray
public boolean isArray()
- Specified by:
isArrayin interfaceCommandLine.Model.ITypeInfo
-
isCollection
public boolean isCollection()
- Specified by:
isCollectionin interfaceCommandLine.Model.ITypeInfo
-
isMap
public boolean isMap()
- Specified by:
isMapin interfaceCommandLine.Model.ITypeInfo
-
isEnum
public boolean isEnum()
Description copied from interface:CommandLine.Model.ITypeInfoReturnstrueifCommandLine.Model.ITypeInfo.getType()is an enum.- Specified by:
isEnumin interfaceCommandLine.Model.ITypeInfo
-
getEnumConstantNames
public java.util.List<java.lang.String> getEnumConstantNames()
- Specified by:
getEnumConstantNamesin 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:
getClassNamein interfaceCommandLine.Model.ITypeInfo- Returns:
- the fully qualified class name of the type
-
getClassSimpleName
public java.lang.String getClassSimpleName()
- Specified by:
getClassSimpleNamein interfaceCommandLine.Model.ITypeInfo
-
getType
public java.lang.Class<?> getType()
Description copied from interface:CommandLine.Model.ITypeInfoReturns 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:
getTypein 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.ITypeInfoReturns 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:
getAuxiliaryTypesin interfaceCommandLine.Model.ITypeInfo- Returns:
- the component type or types of an array, Collection or Map type
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-