Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  * Copyright 2004-2008 the original author or authors.
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * See the License for the specific language governing permissions and
 * limitations under the License.
package org.springframework.binding.convert;
Converts objects from one type to another. May support conversion of multiple source types to multiple target types.

Implementations of this interface are thread-safe and can be shared.

A converter is more generic than a formatter. A formatter only handles converting from String and back, while converters convert from an arbitrary Object type to another.

Keith Donald
See also:
public interface Converter {

The source classes this converter can convert from.

the supported source classes
	public Class[] getSourceClasses();

The target classes this converter can convert to.

the supported target classes
	public Class[] getTargetClasses();

Convert the provided source object argument to an instance of the specified target class.

source the source object to convert, its class must be one of the supported sourceClasses
targetClass the target class to convert the source to, it must be one of the supported targetClasses
context an optional conversion context that may be used to influence the conversion process
the converted object, an instance of the target type
ConversionException an exception occurred during the type conversion
	public Object convert(Object sourceClass targetClassObject contextthrows ConversionException;
New to GrepCode? Check out our FAQ X