org.apache.tools.ant.taskdefs.optional.jmx.converter
Class DefaultValueConverter

java.lang.Object
  |
  +--org.apache.tools.ant.taskdefs.optional.jmx.converter.DefaultValueConverter
All Implemented Interfaces:
ValueConverter

public class DefaultValueConverter
extends java.lang.Object
implements ValueConverter

Converts a String to its equivalent object type. This implementation supports most java.lang.* primitives and their equivalent object types (e.g. int -> Integer, boolean -> Boolean etc.) using the valueOf method through reflection and using a constructor with a single String argument.

Version:
$Version:$
Author:
Brian Dueck

Constructor Summary
DefaultValueConverter()
          Creates a new instance of DefaultValueConverter
 
Method Summary
 java.lang.String[] getSupportedTypes()
          Returns an array of types (Java class names, or Java primitives) this converter supports.
 java.lang.Object valueOf(java.lang.String value, java.lang.String type)
          Converts the specified string value to the specified type (java primitive type or java class name).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultValueConverter

public DefaultValueConverter()
Creates a new instance of DefaultValueConverter
Method Detail

valueOf

public java.lang.Object valueOf(java.lang.String value,
                                java.lang.String type)
                         throws java.lang.Exception
Description copied from interface: ValueConverter
Converts the specified string value to the specified type (java primitive type or java class name).
Specified by:
valueOf in interface ValueConverter
Following copied from interface: org.apache.tools.ant.taskdefs.optional.jmx.converter.ValueConverter
Parameters:
value - The attribute value.
type - The java primitive type or class name.

getSupportedTypes

public java.lang.String[] getSupportedTypes()
Description copied from interface: ValueConverter
Returns an array of types (Java class names, or Java primitives) this converter supports.
Specified by:
getSupportedTypes in interface ValueConverter
Following copied from interface: org.apache.tools.ant.taskdefs.optional.jmx.converter.ValueConverter
Returns:
An array of supported type names.