1 11 12 package org.eclipse.core.internal.databinding.conversion; 13 14 import org.eclipse.core.databinding.conversion.IConverter; 15 16 import com.ibm.icu.text.NumberFormat; 17 18 25 public class NumberToIntegerConverter extends NumberToNumberConverter implements 26 IConverter { 27 28 33 public NumberToIntegerConverter(NumberFormat numberFormat, 34 Class fromType, boolean primitive) { 35 super(numberFormat, fromType, (primitive) ? Integer.TYPE : Integer .class); 36 } 37 38 41 protected Number doConvert(Number number) { 42 if (StringToNumberParser.inIntegerRange(number)) { 43 return new Integer (number.intValue()); 44 } 45 46 return null; 47 } 48 } 49 | Popular Tags |