Class VersionProviderMetaData
- java.lang.Object
-
- picocli.codegen.annotation.processing.VersionProviderMetaData
-
- All Implemented Interfaces:
ITypeMetaData,CommandLine.IVersionProvider
class VersionProviderMetaData extends java.lang.Object implements CommandLine.IVersionProvider, ITypeMetaData
Implementation of theCommandLine.IVersionProviderinterface that provides metadata on the@Command(versionProvider = xxx.class)annotation.- Since:
- 4.0
-
-
Field Summary
Fields Modifier and Type Field Description private javax.lang.model.type.TypeMirrortypeMirror
-
Constructor Summary
Constructors Constructor Description VersionProviderMetaData()VersionProviderMetaData(javax.lang.model.type.TypeMirror typeMirror)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description javax.lang.model.element.TypeElementgetTypeElement()Returns theTypeElementof thetype mirror.javax.lang.model.type.TypeMirrorgetTypeMirror()Returns the TypeMirror that this VersionProviderMetaData was constructed with.java.lang.String[]getVersion()Always returns an empty array.static voidinitVersionProvider(CommandLine.Model.CommandSpec result, CommandLine.Command cmd)Sets the specifiedCommandSpec's CommandLine.Model.CommandSpec.versionProvider(picocli.CommandLine.IVersionProvider) version provider} to aVersionProviderMetaDatainstance if the annotation attribute was present on the specifiedCommandannotation.booleanisDefault()Returnstrueif the command did not have aversionProviderannotation attribute.java.lang.StringtoString()Returns a string representation of this object, for debugging purposes.
-
-
-
Method Detail
-
initVersionProvider
public static void initVersionProvider(CommandLine.Model.CommandSpec result, CommandLine.Command cmd)
Sets the specifiedCommandSpec's CommandLine.Model.CommandSpec.versionProvider(picocli.CommandLine.IVersionProvider) version provider} to aVersionProviderMetaDatainstance if the annotation attribute was present on the specifiedCommandannotation.- Parameters:
result- the command spec to initializecmd- the@Commandannotation to inspect
-
isDefault
public boolean isDefault()
Returnstrueif the command did not have aversionProviderannotation attribute.- Specified by:
isDefaultin interfaceITypeMetaData- Returns:
trueif the command did not have aversionProviderannotation attribute.
-
getTypeMirror
public javax.lang.model.type.TypeMirror getTypeMirror()
Returns the TypeMirror that this VersionProviderMetaData was constructed with.- Specified by:
getTypeMirrorin interfaceITypeMetaData- Returns:
- the TypeMirror of the
@Command(versionProvider = xxx.class)annotation.
-
getTypeElement
public javax.lang.model.element.TypeElement getTypeElement()
Description copied from interface:ITypeMetaDataReturns theTypeElementof thetype mirror.- Specified by:
getTypeElementin interfaceITypeMetaData- Returns:
- the type mirror as a TypeElement
-
getVersion
public java.lang.String[] getVersion()
Always returns an empty array.- Specified by:
getVersionin interfaceCommandLine.IVersionProvider- Returns:
- version information (each string in the array is displayed on a separate line)
-
toString
public java.lang.String toString()
Returns a string representation of this object, for debugging purposes.- Overrides:
toStringin classjava.lang.Object- Returns:
- a string representation of this object
-
-