org.ops4j.pax.runner
Class OptionResolverImpl

java.lang.Object
  extended by org.ops4j.pax.runner.OptionResolverImpl
All Implemented Interfaces:
OptionResolver

public class OptionResolverImpl
extends java.lang.Object
implements OptionResolver

Resolvs options by:
1. look in the cache;
2. look in command line;
3. look for an alias and if found look in the command line for the alias
3. if value is "choose" ask the user;
4. look in configuration for a default value TODO add unit testing

Since:
August 26, 2007
Author:
Alin Dreghiciu

Constructor Summary
OptionResolverImpl(CommandLine commandLine, Configuration configuration)
          Creates anew option resolver.
 
Method Summary
 java.lang.String get(java.lang.String name)
          Returns the value of option.
 java.lang.String getMandatory(java.lang.String name)
          Returns the value of option.
 java.lang.String[] getMultiple(java.lang.String name)
          Returns the value of option that can be specified more times under the same name (as an array of values).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OptionResolverImpl

public OptionResolverImpl(CommandLine commandLine,
                          Configuration configuration)
Creates anew option resolver.

Parameters:
commandLine - command line to use
configuration - configuration to use
Method Detail

get

public java.lang.String get(java.lang.String name)
Returns the value of option.

Specified by:
get in interface OptionResolver
Parameters:
name - option name
Returns:
found value.

getMandatory

public java.lang.String getMandatory(java.lang.String name)
Returns the value of option. If value is null thrwos IllegalArgumentException.

Specified by:
getMandatory in interface OptionResolver
Parameters:
name - option name
Returns:
found value.

getMultiple

public java.lang.String[] getMultiple(java.lang.String name)
Returns the value of option that can be specified more times under the same name (as an array of values).

Specified by:
getMultiple in interface OptionResolver
Parameters:
name - option name
Returns:
found values, or empty aray if option not present.


Copyright © 2006-2011 OPS4J - Open Participation Software for Java. All Rights Reserved.