View Javadoc

1   /*
2    * Copyright 2004-2005 the original author or authors.
3    * 
4    * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5    * use this file except in compliance with the License. You may obtain a copy of
6    * the License at
7    * 
8    * http://www.apache.org/licenses/LICENSE-2.0
9    * 
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12   * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13   * License for the specific language governing permissions and limitations under
14   * the License.
15   */
16  package net.sf.morph.transform;
17  
18  /**
19   * A <code>Transformer</code> that explicitly states which of its source
20   * classes are transformable to which destination classes. In most cases, you
21   * can implicitly assume that a <code>Transformer</code> can transform all
22   * sources to all destinations. However, if the <code>Transformer</code>
23   * implements this interface, that is not the case.
24   * 
25   * @author Matt Sgarlata
26   * @since Nov 26, 2004
27   */
28  public interface ExplicitTransformer {
29  	
30  	/**
31  	 * Specifies which source classes are transformable to which destination
32  	 * classes.
33  	 * 
34  	 * @param destinationType
35  	 *            the destination type to test
36  	 * @param sourceType
37  	 *            the source type to test
38  	 * @return whether the destination type is transformable to the source
39  	 *         type
40  	 * @throws TransformationException
41  	 *             if it could not be determined if <code>sourceType</code>
42  	 *             is transformable into <code>destinationType</code>
43  	 */
44  	public boolean isTransformable(Class destinationType, Class sourceType)
45  		throws TransformationException;
46  
47  }