org.sape.carbon.core.config.type
Interface ConfigurationTypeService

All Superinterfaces:
FunctionalInterface
All Known Implementing Classes:
DefaultConfigurationTypeServiceImpl

public interface ConfigurationTypeService
extends FunctionalInterface

Implementations of this service will provide configuration with a micro level of formatting for individual values within a configuration object. These objects could be URLs, Classes, Strings or any primitive.

Copyright 2002 Sapient

Since:
carbon 1.0
Version:
$Revision: 1.10 $($Author: dvoet $ / $Date: 2003/07/29 19:50:19 $)
Author:
Greg Hinkle, January 2002

Method Summary
 Class getRequiredConfigurationInterface(Class type)
          Gets the required configuration interface for the given complex type.
 boolean isCacheableType(Class type)
          Returns true if instances of type should be cached within configuration objects
 boolean isComplexType(Class type)
          Returns true if type has a complex type handler.
 Configuration toConfiguration(Class type, Object data)
          Translates the supported object type into its Configuration value
 Object toObject(Class type, Configuration value)
          Translates configuration data from its Configuration value into its object form for usage by clients of the configuration service.
 Object toObject(Class type, String value)
          Translates configuration data from its String value into its object form for usage by clients of the configuration service.
 String toString(Class type, Object value)
          Translates the supported object type into its string value
 

Method Detail

toString

public String toString(Class type,
                       Object value)
Translates the supported object type into its string value

Parameters:
type - the Class type of configuration data
value - the object value of the configuration data to translate
Returns:
the string form of the configuration data

toObject

public Object toObject(Class type,
                       String value)
                throws ConfigurationTypeException
Translates configuration data from its String value into its object form for usage by clients of the configuration service.

Parameters:
type - the class type of the data to translate
value - the String value to translate into objects
Returns:
the Object form of the configuration information
Throws:
ConfigurationTypeException - when the String value is not of the proper format or is an invalid value

toConfiguration

public Configuration toConfiguration(Class type,
                                     Object data)
                              throws ConfigurationTypeException
Translates the supported object type into its Configuration value

Parameters:
type - the Class type that data should be stored as
data - the object to be converted to a Configuration type
Returns:
Configuration
Throws:
ConfigurationTypeException - indicates an error parsing configuration value into an object

toObject

public Object toObject(Class type,
                       Configuration value)
                throws ConfigurationTypeException
Translates configuration data from its Configuration value into its object form for usage by clients of the configuration service.

Parameters:
type - the class type of the data to translate
value - the Configuration information to be converted
Returns:
Object
Throws:
ConfigurationTypeException - indicates an error parsing configuration value into an object

isComplexType

public boolean isComplexType(Class type)
Returns true if type has a complex type handler. If this is true, toConfiguration(Class type, Object data) and toObject(Class type, Configuration value) should be used to conv to and from configuration information and objects. If this is false, use toString(Class type, Object value) and toObject(Class type, String value)

Parameters:
type - class to check for complex type handler
Returns:
if the class has a complex type handler

getRequiredConfigurationInterface

public Class getRequiredConfigurationInterface(Class type)
Gets the required configuration interface for the given complex type.

Parameters:
type - must be a complex type
Returns:
Class
See Also:
ComplexConfigurationTypeHandler.getRequiredConfigurationInterface()

isCacheableType

public boolean isCacheableType(Class type)
Returns true if instances of type should be cached within configuration objects

Parameters:
type -
Returns:
true if type can be cached, false otherwise
Since:
carbon 2.1


Copyright 1999-2003 Sapient Corporation. All Rights Reserved.