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  import net.sf.composite.Component;
19  
20  /**
21   * <p>Transforms information taken from a source and makes it available at a
22   * destination.  Each source class is implicitly considered transformable to each
23   * destination class, unless this is an {@link net.sf.morph.transform.ExplicitTransformer}.</p>
24   * 
25   * <p>For performance reasons, it is recommended that transformers be
26   * implemented in a threadsafe manner.  All transformers provided out-of-the-box
27   * by the Morph framework are threadsafe.</p>
28   * 
29   * @author Matt Sgarlata
30   * @since Nov 26, 2004
31   */
32  public interface Transformer extends Component {
33  	
34  	public static final Integer TRANSFORMATION_TYPE_CONVERT = new Integer(1);
35  	public static final Integer TRANSFORMATION_TYPE_COPY = new Integer(2);
36  	
37  	/**
38  	 * Defines the types of objects that can be used as information sources by
39  	 * this transformer. This can be thought of as the valid "output" types for
40  	 * the transformer.
41  	 * 
42  	 * @return the types of objects that can be used as information sources by
43  	 *         this transformer
44  	 */
45  	public Class[] getSourceClasses();
46  
47  	/**
48  	 * Defines the types of objects that can be used as information sources by
49  	 * this transformer. This method can be thought of as specifying the valid
50  	 * "output" types for this transformer.
51  	 * 
52  	 * @return the types of objects that can be used as information sources by
53  	 *         this transformer
54  	 */
55  	public Class[] getDestinationClasses();
56  	
57  }