joptsimple.internal
Class ConstructorInvokingValueConverter<V>

java.lang.Object
  extended by joptsimple.internal.ConstructorInvokingValueConverter<V>
Type Parameters:
V - constraint on the type of values being converted to
All Implemented Interfaces:
ValueConverter<V>

 class ConstructorInvokingValueConverter<V>
extends java.lang.Object
implements ValueConverter<V>

Version:
$Id: ConstructorInvokingValueConverter.java,v 1.2 2009/04/04 01:24:27 pholser Exp $
Author:
Paul Holser

Field Summary
private  java.lang.reflect.Constructor<V> ctor
           
 
Constructor Summary
ConstructorInvokingValueConverter(java.lang.reflect.Constructor<V> ctor)
           
 
Method Summary
 V convert(java.lang.String value)
          Converts the given string value into a Java type.
 java.lang.String valuePattern()
          Gives a string that describes the pattern of the values this converter expects, if any.
 java.lang.Class<V> valueType()
          Gives the class of the type of values this converter converts to.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ctor

private final java.lang.reflect.Constructor<V> ctor
Constructor Detail

ConstructorInvokingValueConverter

ConstructorInvokingValueConverter(java.lang.reflect.Constructor<V> ctor)
Method Detail

convert

public V convert(java.lang.String value)
Converts the given string value into a Java type.

Specified by:
convert in interface ValueConverter<V>
Parameters:
value - the string to convert
Returns:
the converted value

valueType

public java.lang.Class<V> valueType()
Gives the class of the type of values this converter converts to.

Specified by:
valueType in interface ValueConverter<V>
Returns:
the target class for conversion

valuePattern

public java.lang.String valuePattern()
Gives a string that describes the pattern of the values this converter expects, if any. For example, a date converter can respond with a date format string.

Specified by:
valuePattern in interface ValueConverter<V>
Returns:
a value pattern, or null if there's nothing interesting here