Class DefaultValueProviderMetaData

    • Field Detail

      • typeMirror

        private final javax.lang.model.type.TypeMirror typeMirror
    • Constructor Detail

      • DefaultValueProviderMetaData

        public DefaultValueProviderMetaData()
      • DefaultValueProviderMetaData

        public DefaultValueProviderMetaData​(javax.lang.model.type.TypeMirror typeMirror)
    • Method Detail

      • initDefaultValueProvider

        public static void initDefaultValueProvider​(CommandLine.Model.CommandSpec result,
                                                    CommandLine.Command cmd)
        Sets the specified CommandSpec's default value provider to a DefaultValueProviderMetaData instance if the annotation attribute was present on the specified Command annotation.
        Parameters:
        result - the command spec to initialize
        cmd - the @Command annotation to inspect
      • isDefault

        public boolean isDefault()
        Returns true if the command did not have a defaultValueProvider annotation attribute.
        Specified by:
        isDefault in interface ITypeMetaData
        Returns:
        true if the command did not have a defaultValueProvider annotation attribute.
      • getTypeMirror

        public javax.lang.model.type.TypeMirror getTypeMirror()
        Returns the TypeMirror that this DefaultValueProviderMetaData was constructed with.
        Specified by:
        getTypeMirror in interface ITypeMetaData
        Returns:
        the TypeMirror of the @Command(defaultValueProvider = xxx.class) annotation.
      • getTypeElement

        public javax.lang.model.element.TypeElement getTypeElement()
        Description copied from interface: ITypeMetaData
        Returns the TypeElement of the type mirror.
        Specified by:
        getTypeElement in interface ITypeMetaData
        Returns:
        the type mirror as a TypeElement
      • defaultValue

        public java.lang.String defaultValue​(CommandLine.Model.ArgSpec argSpec)
        Always returns null.
        Specified by:
        defaultValue in interface CommandLine.IDefaultValueProvider
        Parameters:
        argSpec - the option or positional parameter, never null
        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 class java.lang.Object
        Returns:
        a string representation of this object