View Javadoc

1   /*
2    * Copyright 2006-2007 the original author or authors.
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of 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,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  
17  package net.sf.ezmorph;
18  
19  /**
20   * Marker interface for morphers.<br>
21   * All implementations must have a <code>morph( Object value )</code> method
22   * that returns the appropiate morphed value.
23   *
24   * @author Andres Almiray <aalmiray@users.sourceforge.net>
25   */
26  public interface Morpher
27  {
28     /**
29      * Returns the target Class for conversion.
30      *
31      * @return the target Class for conversion.
32      */
33     Class morphsTo();
34  
35     /**
36      * Returns true if the Morpher supports conversion from this Class.
37      *
38      * @param clazz the source Class
39      * @return true if clazz is supported by this morpher, false otherwise.
40      */
41     boolean supports( Class clazz );
42  }