This commit is contained in:
Keith Donald 2009-03-31 15:55:42 +00:00
parent 7f6fc4e82e
commit d38c0d301c
6 changed files with 96 additions and 8 deletions

View File

@ -1,3 +1,18 @@
/*
* Copyright 2004-2009 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.core.convert; package org.springframework.core.convert;
import java.lang.annotation.Annotation; import java.lang.annotation.Annotation;

View File

@ -1,3 +1,18 @@
/*
* Copyright 2004-2009 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.core.convert; package org.springframework.core.convert;
/** /**

View File

@ -1,9 +1,38 @@
/*
* Copyright 2004-2009 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.core.convert.converter; package org.springframework.core.convert.converter;
import org.springframework.core.convert.ConversionService;
/**
* A meta interface a Converter may implement to describe what types he can convert between.
* Implementing this interface is required for converters that do not declare their parameterized types S and T and expect to be registered with a {@link ConversionService}.
* @see Converter
* @see SuperConverter
*/
public interface ConverterInfo { public interface ConverterInfo {
/**
* The source type the converter converts from.
*/
public Class<?> getSourceType(); public Class<?> getSourceType();
/**
* The target type the converter converts to.
*/
public Class<?> getTargetType(); public Class<?> getTargetType();
} }

View File

@ -1,3 +1,18 @@
/*
* Copyright 2004-2009 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.core.convert.converter; package org.springframework.core.convert.converter;
import org.springframework.core.convert.ConversionException; import org.springframework.core.convert.ConversionException;
@ -14,10 +29,10 @@ import org.springframework.core.convert.ConversionService;
public interface SuperTwoWayConverter<S, T> extends SuperConverter<S, T> { public interface SuperTwoWayConverter<S, T> extends SuperConverter<S, T> {
/** /**
* Convert the target of type T to an instance of S. * Convert the target of type T to an instance of RS.
* @param target the target object to convert, whose class must be equal to or a subclass of T * @param target the target object to convert, whose class must be equal to or a subclass of T
* @param sourceClass the requested source class to convert to, which must be equal to S or extend from S * @param sourceClass the requested source class to convert to, which must be equal to S or extend from S
* @return the converted object, which must be an instance of S * @return the converted object, which must be an instance of RS
* @throws Exception an exception occurred performing the conversion; may be any checked exception, the conversion * @throws Exception an exception occurred performing the conversion; may be any checked exception, the conversion
* system will handle wrapping the failure in a {@link ConversionException} that provides a consistent type * system will handle wrapping the failure in a {@link ConversionException} that provides a consistent type
* conversion error context * conversion error context

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2009 the original author or authors. * Copyright 2004-2009 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.core.convert.service; package org.springframework.core.convert.service;
import org.springframework.core.convert.ConversionExecutionException; import org.springframework.core.convert.ConversionExecutionException;

View File

@ -1,3 +1,18 @@
/*
* Copyright 2004-2009 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.core.convert.service; package org.springframework.core.convert.service;
import org.springframework.core.convert.converter.Converter; import org.springframework.core.convert.converter.Converter;