KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jface > internal > databinding > provisional > conversion > IConverter


1 /*******************************************************************************
2  * Copyright (c) 2005, 2006 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.jface.internal.databinding.provisional.conversion;
12
13 /**
14  * A one-way converter.
15  * <p>
16  * <strong>EXPERIMENTAL</strong>. This class or interface has been added as
17  * part of a work in progress. There is no guarantee that this API will remain
18  * unchanged during the 3.2 release cycle. Please do not use this API without
19  * consulting with the Platform/UI team.
20  * </p>
21  *
22  * @since 1.0
23  *
24  */

25 public interface IConverter {
26
27     /**
28      * Returns the type whose instances can be converted by this converter.
29      *
30      * @return the type whose instances can be converted, or null if this converter is untyped
31      */

32     public Object JavaDoc getFromType();
33
34     /**
35      * Returns the type to which this converter can convert.
36      *
37      * @return the type to which this converter can convert, or null if this converter is untyped
38      */

39     public Object JavaDoc getToType();
40
41     /**
42      * Returns the result of the conversion of the given object. The given
43      * object must be an instance of getTargetType(), and the result must be an
44      * instance of getModelType().
45      *
46      * @param fromObject
47      * the object to convert
48      * @return the converted object
49      */

50     public Object JavaDoc convert(Object JavaDoc fromObject);
51 }
52
Popular Tags