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

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

public class ValueFactory
extends java.lang.Object
implements ValueConverter

ValueFactory is a singleton implementation of ValueConverter and is considered the main entry point for ValueConverter clients. Clients should use this ValueFactory class rather than individual ValueConverter implementations. ValueConverter implementations are registered with ValueFactory using the Main factory for all ValueConverter implementations.

Version:
$Id: ValueFactory.java,v 1.8 2003/05/28 22:28:26 bdueck Exp $
Author:
Brian Dueck

Method Summary
static java.lang.String arrayToString(java.lang.Object array)
          Stringifies an array.
static ValueFactory getInstance()
          Returns the singleton instance of ValueFactory.
 java.lang.String[] getSupportedTypes()
          Returns an array of types (Java class names, or Java primitives) this converter supports.
 void registerValueConverter(ValueConverter converter)
          Registers a ValueConverter with this ValueFactory.
static java.lang.String toString(java.lang.Object value)
          Stringifies a value - can handle array and non-array values.
 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
 

Method Detail

getInstance

public static ValueFactory getInstance()
Returns the singleton instance of ValueFactory.

registerValueConverter

public void registerValueConverter(ValueConverter converter)
Registers a ValueConverter with this ValueFactory. After the ValueConverter has been registered, the ValueFactory will automatically delegate calls to its valueOf() method to the appropriate ValueConverter for the type being referenced.
Parameters:
converter - The ValueConverter to register.

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.

arrayToString

public static java.lang.String arrayToString(java.lang.Object array)
Stringifies an array.

toString

public static java.lang.String toString(java.lang.Object value)
Stringifies a value - can handle array and non-array values.