ilog.cpl.util
Interface IlpTypeConverter

All Known Implementing Classes:
IlpDefaultTypeConverter

public interface IlpTypeConverter

Interface for conversion utilities. This interface is mostly used when parsing or writing XML. A type converter can be retrieved from the context.

Since:
JTGO 3.0
See Also:
IlpContext

Method Summary
 Object convertTo(Class type, Object value)
          General conversion method to convert a non-null value.
 Object createJavaInstance(Class type, String value)
          Creates a Java instance from a class type.
 String createStringValue(Class type, Object value)
          Creates a String value from a general Java Object.
 IlpSAXSerializable getAttributeValueHandler(Class attributeValueClass)
          Returns the way an attribute should be read from or written in XML.
 

Method Detail

createJavaInstance

Object createJavaInstance(Class type,
                          String value)
Creates a Java instance from a class type. The value is initialized with the supplied string value. IlEnum, dates, colors and fonts are specifically supported. Icons are also specifically supported to add a full path to the icon name. Otherwise, all Java basic types and any Java class which has a string constructor are supported.

Parameters:
type - The class of the instance to be created.
value - The value to be assigned to the new instance.

createStringValue

String createStringValue(Class type,
                         Object value)
Creates a String value from a general Java Object.

This method produces string values that can be used in an XML file. Specifically, dates, colors and fonts produce strings that are correctly formatted for use in data storage XML files. Any types that are not specifically handled will return the result from calling toString() on the value.

Parameters:
type - Target class to create the string for. The type may be null for general conversion. You can specify a different value if the target type does not correspond to the current value class.
value - The instance to be converted to a string value.
Returns:
The string value associated with the object instance.

convertTo

Object convertTo(Class type,
                 Object value)
General conversion method to convert a non-null value.

Parameters:
type - Target class to convert.
value - The instance to be converted.

getAttributeValueHandler

IlpSAXSerializable getAttributeValueHandler(Class attributeValueClass)
Returns the way an attribute should be read from or written in XML. depending on its Java class.

Parameters:
attributeValueClass - The class of the attribute to be read from or written in XML.
Returns:
The IlpSAXSerializable instance that contains the way the attribute should be read from or written in XML.


Copyright © 1996-2007 ILOG S.A. All rights reserved.   Documentation homepage.   . All Rights Reserved.