Class DefaultValueProviderMetaData
- java.lang.Object
-
- picocli.codegen.annotation.processing.DefaultValueProviderMetaData
-
- All Implemented Interfaces:
ITypeMetaData
,CommandLine.IDefaultValueProvider
class DefaultValueProviderMetaData extends java.lang.Object implements CommandLine.IDefaultValueProvider, ITypeMetaData
Implementation of theCommandLine.IDefaultValueProvider
interface that provides metadata on the@Command(defaultValueProvider = xxx.class)
annotation.- Since:
- 4.0
-
-
Field Summary
Fields Modifier and Type Field Description private javax.lang.model.type.TypeMirror
typeMirror
-
Constructor Summary
Constructors Constructor Description DefaultValueProviderMetaData()
DefaultValueProviderMetaData(javax.lang.model.type.TypeMirror typeMirror)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
defaultValue(CommandLine.Model.ArgSpec argSpec)
Always returnsnull
.javax.lang.model.element.TypeElement
getTypeElement()
Returns theTypeElement
of thetype mirror
.javax.lang.model.type.TypeMirror
getTypeMirror()
Returns the TypeMirror that this DefaultValueProviderMetaData was constructed with.static void
initDefaultValueProvider(CommandLine.Model.CommandSpec result, CommandLine.Command cmd)
Sets the specifiedCommandSpec
's default value provider to aDefaultValueProviderMetaData
instance if the annotation attribute was present on the specifiedCommand
annotation.boolean
isDefault()
Returnstrue
if the command did not have adefaultValueProvider
annotation attribute.java.lang.String
toString()
Returns a string representation of this object, for debugging purposes.
-
-
-
Method Detail
-
initDefaultValueProvider
public static void initDefaultValueProvider(CommandLine.Model.CommandSpec result, CommandLine.Command cmd)
Sets the specifiedCommandSpec
's default value provider to aDefaultValueProviderMetaData
instance if the annotation attribute was present on the specifiedCommand
annotation.- Parameters:
result
- the command spec to initializecmd
- the@Command
annotation to inspect
-
isDefault
public boolean isDefault()
Returnstrue
if the command did not have adefaultValueProvider
annotation attribute.- Specified by:
isDefault
in interfaceITypeMetaData
- Returns:
true
if the command did not have adefaultValueProvider
annotation attribute.
-
getTypeMirror
public javax.lang.model.type.TypeMirror getTypeMirror()
Returns the TypeMirror that this DefaultValueProviderMetaData was constructed with.- Specified by:
getTypeMirror
in interfaceITypeMetaData
- Returns:
- the TypeMirror of the
@Command(defaultValueProvider = xxx.class)
annotation.
-
getTypeElement
public javax.lang.model.element.TypeElement getTypeElement()
Description copied from interface:ITypeMetaData
Returns theTypeElement
of thetype mirror
.- Specified by:
getTypeElement
in interfaceITypeMetaData
- Returns:
- the type mirror as a TypeElement
-
defaultValue
public java.lang.String defaultValue(CommandLine.Model.ArgSpec argSpec)
Always returnsnull
.- Specified by:
defaultValue
in interfaceCommandLine.IDefaultValueProvider
- Parameters:
argSpec
- the option or positional parameter, nevernull
- Returns:
- the default value for the option or positional parameter, or
null
if this provider has no default value for the specified option or positional parameter
-
toString
public java.lang.String toString()
Returns a string representation of this object, for debugging purposes.- Overrides:
toString
in classjava.lang.Object
- Returns:
- a string representation of this object
-
-