Coverage Report - joptsimple.NoArgumentOptionSpec
 
Classes in this File Line Coverage Branch Coverage Complexity
NoArgumentOptionSpec
100%
10/10
N/A
1
 
 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.Collections;
 9  
 import java.util.List;
 10  
 
 11  
 /**
 12  
  * <p>A specification for an option that does not accept arguments.</p>
 13  
  *
 14  
  * @since 1.0
 15  
  * @author <a href="mailto:pholser@alumni.rice.edu">Paul Holser</a>
 16  
  * @version $Id: NoArgumentOptionSpec.java,v 1.3 2008/04/10 19:41:55 pholser Exp $
 17  
  */
 18  
 class NoArgumentOptionSpec extends OptionSpec {
 19  
     NoArgumentOptionSpec( String option ) {
 20  90
         this( Collections.singletonList( option ), "" );
 21  90
     }
 22  
 
 23  
     NoArgumentOptionSpec( List options, String description ) {
 24  632
         super( options, description );
 25  632
     }
 26  
 
 27  
     void handleOption( OptionParser parser, ArgumentList arguments,
 28  
         OptionSet detectedOptions, String detectedArgument ) {
 29  
 
 30  116
         detectedOptions.addAll( options() );
 31  116
     }
 32  
 
 33  
     boolean acceptsArguments() {
 34  30
         return false;
 35  
     }
 36  
 
 37  
     boolean requiresArgument() {
 38  10
         return false;
 39  
     }
 40  
 
 41  
     void accept( OptionSpecVisitor visitor ) {
 42  42
         visitor.visit( this );
 43  42
     }
 44  
 }