Mercurial > projects > dwt2
annotate org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/conversion/DateToStringConverter.d @ 88:9e0ab372d5d8
Revert from TypeInfo/ClassInfo to java.lang.Class
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Sun, 19 Apr 2009 11:10:09 +0200 |
parents | 6be48cf9f95c |
children |
rev | line source |
---|---|
78 | 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; | |
81 | 13 import org.eclipse.core.internal.databinding.conversion.DateConversionSupport; |
78 | 14 |
15 import java.lang.all; | |
16 | |
17 import java.util.Date; | |
18 | |
19 import org.eclipse.core.databinding.conversion.IConverter; | |
20 | |
21 | |
22 /** | |
23 * Converts a Java.util.Date to a String using the current locale. Null date | |
24 * values are converted to an empty string. | |
25 * | |
26 * @since 1.0 | |
27 */ | |
28 public class DateToStringConverter : DateConversionSupport , IConverter { | |
29 public Object convert(Object source) { | |
30 if (source !is null) | |
85 | 31 return stringcast(format(cast(Date)source)); |
32 return stringcast(""); //$NON-NLS-1$ | |
78 | 33 } |
34 | |
35 public Object getFromType() { | |
88
9e0ab372d5d8
Revert from TypeInfo/ClassInfo to java.lang.Class
Frank Benoit <benoit@tionex.de>
parents:
85
diff
changeset
|
36 return Class.fromType!(Date); |
78 | 37 } |
38 | |
39 public Object getToType() { | |
88
9e0ab372d5d8
Revert from TypeInfo/ClassInfo to java.lang.Class
Frank Benoit <benoit@tionex.de>
parents:
85
diff
changeset
|
40 return Class.fromType!(StringCls); |
78 | 41 } |
42 } |