KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > core > databinding > conversion > IConverter


1 /*******************************************************************************
2  * Copyright (c) 2005, 2007 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.core.databinding.conversion;
12
13 /**
14  * A one-way converter.
15  *
16  * This interface is not intended to be implemented by clients; clients should
17  * subclass {@link Converter}.
18  *
19  * @since 1.0
20  *
21  */

22 public interface IConverter {
23
24     /**
25      * Returns the type whose instances can be converted by this converter. The
26      * return type is Object rather than Class to optionally support richer type
27      * systems than the one provided by Java reflection.
28      *
29      * @return the type whose instances can be converted, or null if this
30      * converter is untyped
31      */

32     public Object JavaDoc getFromType();
33
34     /**
35      * Returns the type to which this converter can convert. The return type is
36      * Object rather than Class to optionally support richer type systems than
37      * the one provided by Java reflection.
38      *
39      * @return the type to which this converter can convert, or null if this
40      * converter is untyped
41      */

42     public Object JavaDoc getToType();
43
44     /**
45      * Returns the result of the conversion of the given object.
46      *
47      * @param fromObject
48      * the object to convert, of type {@link #getFromType()}
49      * @return the converted object, of type {@link #getToType()}
50      */

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