1 12 package org.eclipse.jface.internal.databinding.provisional.conversion; 13 14 17 public class ToStringConverter implements IConverter { 18 19 22 public static final ToStringConverter TOSTRINGFUNCTION = new ToStringConverter(); 23 24 private final Class fromClass; 25 26 29 public ToStringConverter() { 30 this(Object .class); 31 } 32 33 36 public ToStringConverter(Class fromClass) { 37 this.fromClass = fromClass; 38 } 39 40 45 public Object convert(Object source) { 46 if (source == null) { 47 return ""; } 49 return source.toString(); 50 } 51 52 public Object getFromType() { 53 return fromClass; 54 } 55 56 public Object getToType() { 57 return String .class; 58 } 59 60 } 61 | Popular Tags |