@ Override public void populateObject ( ProcessedCommand < Command < CI > , CI > processedCommand , InvocationProviders invocationProviders , AeshContext aeshContext , CommandLineParser . Mode mode ) throws CommandLineParserException , OptionValidatorException { if ( processedCommand . parserExceptions ( ) . size ( ) > 0 && mode == CommandLineParser . Mode . VALIDATE ) throw processedCommand . parserExceptions ( ) . get ( 0 ) ; for ( ProcessedOption option : processedCommand . getOptions ( ) ) { if ( option . getValues ( ) != null && option . getValues ( ) . size ( ) > 0 ) option . injectValueIntoField ( getObject ( ) , invocationProviders , aeshContext , mode == CommandLineParser . Mode . VALIDATE ) ; else if ( option . getDefaultValues ( ) . size ( ) > 0 ) { option . injectValueIntoField ( getObject ( ) , invocationProviders , aeshContext , mode == CommandLineParser . Mode . VALIDATE ) ; } else if ( option . getOptionType ( ) . equals ( OptionType . GROUP ) && option . getProperties ( ) . size ( ) > 0 ) option . injectValueIntoField ( getObject ( ) , invocationProviders , aeshContext , mode == CommandLineParser . Mode . VALIDATE ) ; else resetField ( getObject ( ) , option . getFieldName ( ) , option . hasValue ( ) ) ; } //arguments if ( processedCommand . getArguments ( ) != null && ( processedCommand . getArguments ( ) . getValues ( ) . size ( ) > 0 || processedCommand . getArguments ( ) . getDefaultValues ( ) . size ( ) > 0 ) ) processedCommand . getArguments ( ) . injectValueIntoField ( getObject ( ) , invocationProviders , aeshContext , mode == CommandLineParser . Mode . VALIDATE ) ; else if ( processedCommand . getArguments ( ) != null ) resetField ( getObject ( ) , processedCommand . getArguments ( ) . getFieldName ( ) , true ) ; //argument if ( processedCommand . getArgument ( ) != null && ( processedCommand . getArgument ( ) . getValues ( ) . size ( ) > 0 || processedCommand . getArgument ( ) . getDefaultValues ( ) . size ( ) > 0 ) ) processedCommand . getArgument ( ) . injectValueIntoField ( getObject ( ) , invocationProviders , aeshContext , mode == CommandLineParser . Mode . VALIDATE ) ; else if ( processedCommand . getArgument ( ) != null ) resetField ( getObject ( ) , processedCommand . getArgument ( ) . getFieldName ( ) , true ) ; }
Populate a Command instance with the values parsed from a command line If any parser errors are detected it will throw an exception