Coverage Report - joptsimple.AlternativeLongOptionSpec
 
Classes in this File Line Coverage Branch Coverage Complexity
AlternativeLongOptionSpec
100%
9/9
100%
2/2
1.667
 
 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  
 
 10  
 /**
 11  
  * <p>Represents the <kbd>"-W"</kbd> form of long option specification.</p>
 12  
  *
 13  
  * @since 1.0
 14  
  * @author <a href="mailto:pholser@alumni.rice.edu">Paul Holser</a>
 15  
  * @version $Id: AlternativeLongOptionSpec.java,v 1.2 2008/04/08 03:20:18 pholser Exp $
 16  
  */
 17  
 class AlternativeLongOptionSpec extends ArgumentAcceptingOptionSpec {
 18  
     AlternativeLongOptionSpec() {
 19  22
         super( Collections.singletonList( ParserRules.RESERVED_FOR_EXTENSIONS ), true,
 20  
             "Alternative form of long options" );
 21  
 
 22  22
         describedAs( "opt=value" );
 23  22
     }
 24  
 
 25  
     protected void detectOptionArgument( OptionParser parser, ArgumentList arguments,
 26  
         OptionSet detectedOptions ) {
 27  
 
 28  16
         if ( !arguments.hasMore() )
 29  2
             throw new OptionMissingRequiredArgumentException( options() );
 30  
 
 31  14
         arguments.treatNextAsLongOption();
 32  14
     }
 33  
 
 34  
     void accept( OptionSpecVisitor visitor ) {
 35  2
         visitor.visit( this );
 36  2
     }
 37  
 }