Mercurial > projects > dwt2
comparison org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/conversion/DateToStringConverter.d @ 78:0a55d2d5a946
Added file for databinding
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Tue, 14 Apr 2009 11:35:29 +0200 |
parents | |
children | 383ce7bd736b |
comparison
equal
deleted
inserted
replaced
76:f05e6e8b2f2d | 78:0a55d2d5a946 |
---|---|
1 /* | |
2 * Copyright cast(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 module org.eclipse.core.internal.databinding.conversion.DateToStringConverter; | |
13 | |
14 import java.lang.all; | |
15 | |
16 import java.util.Date; | |
17 | |
18 import org.eclipse.core.databinding.conversion.IConverter; | |
19 | |
20 | |
21 /** | |
22 * Converts a Java.util.Date to a String using the current locale. Null date | |
23 * values are converted to an empty string. | |
24 * | |
25 * @since 1.0 | |
26 */ | |
27 public class DateToStringConverter : DateConversionSupport , IConverter { | |
28 public Object convert(Object source) { | |
29 if (source !is null) | |
30 return format(cast(Date)source); | |
31 return ""; //$NON-NLS-1$ | |
32 } | |
33 | |
34 public Object getFromType() { | |
35 return Date.classinfo; | |
36 } | |
37 | |
38 public Object getToType() { | |
39 return String.classinfo; | |
40 } | |
41 } |