net.sf.mmm.util.cli.base
Class CliState.CliArgumentFormatter

java.lang.Object
  extended by net.sf.mmm.util.cli.base.CliState.CliArgumentFormatter
All Implemented Interfaces:
SimpleValueConverter<CliArgumentContainer,String>
Enclosing class:
CliState

protected static final class CliState.CliArgumentFormatter
extends Object
implements SimpleValueConverter<CliArgumentContainer,String>

This inner class converts a CliArgumentContainer to a String.


Field Summary
protected static CliState.CliArgumentFormatter INSTANCE
          The singleton instance.
 
Constructor Summary
protected CliState.CliArgumentFormatter()
           
 
Method Summary
 String convert(CliArgumentContainer value, Object valueSource, Class<? extends String> targetClass)
          This method converts the given pojo to the <TARGET>-type.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INSTANCE

protected static final CliState.CliArgumentFormatter INSTANCE
The singleton instance.

Constructor Detail

CliState.CliArgumentFormatter

protected CliState.CliArgumentFormatter()
Method Detail

convert

public String convert(CliArgumentContainer value,
                      Object valueSource,
                      Class<? extends String> targetClass)
               throws ValueException
This method converts the given pojo to the <TARGET>-type.

Specified by:
convert in interface SimpleValueConverter<CliArgumentContainer,String>
Parameters:
value - is the value to convert.
valueSource - describes the source of the value. This may be the filename where the value was read from, an XPath where the value was located in an XML document, etc. It is used in exceptions thrown if something goes wrong. This will help to find the problem easier.
targetClass - is the type to convert the value to.
Returns:
the converted value or null if the conversion is NOT possible. The returned value has to be an instance of the given targetType.
Throws:
ValueException - if the conversion failed (e.g. the given value is illegal for the given targetClass).


Copyright © 2001-2010 mmm-Team. All Rights Reserved.