KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jface > internal > databinding > provisional > factories > BindSupportFactory


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.factories;
12
13 import org.eclipse.jface.internal.databinding.provisional.conversion.IConverter;
14 import org.eclipse.jface.internal.databinding.provisional.validation.IDomainValidator;
15 import org.eclipse.jface.internal.databinding.provisional.validation.IValidator;
16
17 /**
18  * A factory for creating validators and converters. This interface is not
19  * intended to be implemented directly. Instead, extend the abstract
20  * BindSupportFactory class.
21  * <p>
22  * <strong>EXPERIMENTAL</strong>. This class or interface has been added as
23  * part of a work in progress. There is no guarantee that this API will remain
24  * unchanged during the 3.2 release cycle. Please do not use this API without
25  * consulting with the Platform/UI team.
26  * </p>
27  *
28  * @since 1.0
29  *
30  */

31 public abstract class BindSupportFactory {
32
33     /**
34      * Creates a validator for the given from and to types and model
35      * description. Either toType or modelDescription can be null, but not both.
36      * The returned validator (if not null) should validate arbitrary values of
37      * type toType, and (in the case that toType is given) ensure that they can
38      * be converted to toType, and (in the case that modelDescription is given)
39      * ensure that they can be converted to the type expected by updatable
40      * objects created from the given model description.
41      *
42      * @param fromType
43      * The type to validate
44      * @param toType
45      * The type to convert to after successful validation, or
46      * <code>null</code> if not known
47      * @return a validator, or <code>null</code> if this factory cannot create
48      * a validator for the given arguments.
49      */

50     public IValidator createValidator(Object JavaDoc fromType, Object JavaDoc toType) {
51         return null;
52     }
53
54     /**
55      * Creates a domain validator for the given model description. Either
56      * modelType or modelDescription can be null, but not both.
57      *
58      * @param modelType
59      * The type to validate or <code>null</code> if not known
60      * @return IDomainValidator
61      */

62     public IDomainValidator createDomainValidator(Object JavaDoc modelType) {
63         return null;
64     }
65
66     /**
67      * Creates a converter for the given from and to types and model
68      * description. Either toType or modelDescription can be null, but not both.
69      * The returned converter (if not null) should convert values of type
70      * fromType to values of type toType (in the case that toType is given), and
71      * (in the case that modelDescription is given) convert to the type expected
72      * by updatable objects created from the given model description.
73      *
74      * @param fromType
75      * The type to convert from
76      * @param toType
77      * The type to convert to, or <code>null</code> if not known
78      * @return a converter, or <code>null</code> if this factory cannot create
79      * a converter for the given arguments.
80      */

81     public IConverter createConverter(Object JavaDoc fromType, Object JavaDoc toType) {
82         return null;
83     }
84
85     /**
86      * @param fromType
87      * @param toType
88      * @return whether fromType is assignable to toType, or <code>null</code>
89      * if this factory cannot determine assignability between the given
90      * types
91      */

92     public Boolean JavaDoc isAssignableFromTo(Object JavaDoc fromType, Object JavaDoc toType) {
93         return null;
94     }
95 }
96
Popular Tags