Coverage Report - joptsimple.RequiredArgumentOptionSpec
 
Classes in this File Line Coverage Branch Coverage Complexity
RequiredArgumentOptionSpec
100%
10/10
100%
2/2
1.5
 
 1  
 /*
 2  
  Copyright 2004-2008 Paul R. Holser, Jr.  All rights reserved.
 3  
  Licensed under the Academic Free License version 3.0
 4  
  */
 5  
 
 6  
 package joptsimple;
 7  
 
 8  
 import java.util.List;
 9  
 
 10  
 /**
 11  
  * <p>Specification of an option that accepts a required argument.</p>
 12  
  *
 13  
  * @since 1.0
 14  
  * @author <a href="mailto:pholser@alumni.rice.edu">Paul Holser</a>
 15  
  * @version $Id: RequiredArgumentOptionSpec.java,v 1.4 2008/04/30 19:47:40 pholser Exp $
 16  
  */
 17  
 class RequiredArgumentOptionSpec extends ArgumentAcceptingOptionSpec {
 18  
     RequiredArgumentOptionSpec( String option ) {
 19  96
         super( option, true );
 20  96
     }
 21  
 
 22  
     RequiredArgumentOptionSpec( List options, String description ) {
 23  138
         super( options, true, description );
 24  138
     }
 25  
 
 26  
     protected void detectOptionArgument( OptionParser parser, ArgumentList arguments,
 27  
         OptionSet detectedOptions ) {
 28  
 
 29  98
         if ( !arguments.hasMore() )
 30  4
             throw new OptionMissingRequiredArgumentException( options() );
 31  
 
 32  94
         addArguments( detectedOptions, arguments.next() );
 33  90
     }
 34  
 
 35  
     void accept( OptionSpecVisitor visitor ) {
 36  28
         visitor.visit( this );
 37  28
     }
 38  
 }