KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > core > internal > databinding > conversion > StringToBooleanConverter


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

12 package org.eclipse.core.internal.databinding.conversion;
13
14 /**
15  * StringToBooleanConverter.
16  */

17 public class StringToBooleanConverter extends StringToBooleanPrimitiveConverter {
18
19     /*
20      * (non-Javadoc)
21      *
22      * @see org.eclipse.jface.binding.converter.IConverter#convert(java.lang.Object)
23      */

24     public Object JavaDoc convert(Object JavaDoc source) {
25         String JavaDoc sourceString = (String JavaDoc) source;
26         if ("".equals(sourceString.trim())) { //$NON-NLS-1$
27
return null;
28         }
29         return super.convert(source);
30     }
31
32     public Object JavaDoc getToType() {
33         return Boolean JavaDoc.class;
34     }
35
36 }
37
Popular Tags