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)
|
|
31 return format(cast(Date)source);
|
|
32 return ""; //$NON-NLS-1$
|
|
33 }
|
|
34
|
|
35 public Object getFromType() {
|
|
36 return Date.classinfo;
|
|
37 }
|
|
38
|
|
39 public Object getToType() {
|
|
40 return String.classinfo;
|
|
41 }
|
|
42 }
|