Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 


Eclipse Platform
Release 3.5

org.eclipse.core.databinding.conversion
Class StringToNumberConverter

java.lang.Object
  extended by 

org.eclipse.core.databinding.conversion.Converter
      extended by org.eclipse.core.internal.databinding.validation.NumberFormatConverter
          extended by 
org.eclipse.core.databinding.conversion.StringToNumberConverter
All Implemented Interfaces:
IConverter

public class StringToNumberConverter
extends org.eclipse.core.internal.databinding.validation.NumberFormatConverter

Converts a String to a Number using NumberFormat.parse(...). This class is thread safe.

Since:
1.0

Method Summary
  Object convert ( Object fromObject)
          Converts the provided fromObject to the requested to type.
static  StringToNumberConverter toBigDecimal ()
           
static  StringToNumberConverter toBigDecimal (com.ibm.icu.text.NumberFormat numberFormat)
           
static  StringToNumberConverter toBigInteger ()
           
static  StringToNumberConverter toBigInteger (com.ibm.icu.text.NumberFormat numberFormat)
           
static  StringToNumberConverter toByte (boolean primitive)
           
static  StringToNumberConverter toByte (com.ibm.icu.text.NumberFormat numberFormat, boolean primitive)
           
static  StringToNumberConverter toDouble (boolean primitive)
           
static  StringToNumberConverter toDouble (com.ibm.icu.text.NumberFormat numberFormat, boolean primitive)
           
static  StringToNumberConverter toFloat (boolean primitive)
           
static  StringToNumberConverter toFloat (com.ibm.icu.text.NumberFormat numberFormat, boolean primitive)
           
static  StringToNumberConverter toInteger (boolean primitive)
           
static  StringToNumberConverter toInteger (com.ibm.icu.text.NumberFormat numberFormat, boolean primitive)
           
static  StringToNumberConverter toLong (boolean primitive)
           
static  StringToNumberConverter toLong (com.ibm.icu.text.NumberFormat numberFormat, boolean primitive)
           
static  StringToNumberConverter toShort (boolean primitive)
           
static  StringToNumberConverter toShort (com.ibm.icu.text.NumberFormat numberFormat, boolean primitive)
           
 
Methods inherited from class org.eclipse.core.databinding.conversion. Converter
getFromType, getToType
 
Methods inherited from class java.lang. Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

convert

public 
Object convert(
Object fromObject)
Converts the provided fromObject to the requested to type.

Parameters:
fromObject - the object to convert, of type IConverter.getFromType()
Returns:
the converted object, of type IConverter.getToType()
Throws:
IllegalArgumentException - if the value isn't in the format required by the NumberFormat or the value is out of range for the to type.
IllegalArgumentException - if conversion was not possible
See Also:
IConverter.convert(java.lang.Object)

toInteger

public static 
StringToNumberConverter toInteger(boolean primitive)
Parameters:
primitive - true if the convert to type is an int
Returns:
to Integer converter for the default locale

toInteger

public static 
StringToNumberConverter toInteger(com.ibm.icu.text.NumberFormat numberFormat,
                                                boolean primitive)
Parameters:
numberFormat -
primitive -
Returns:
to Integer converter with the provided numberFormat

toDouble

public static 
StringToNumberConverter toDouble(boolean primitive)
Parameters:
primitive - true if the convert to type is a double
Returns:
to Double converter for the default locale

toDouble

public static 
StringToNumberConverter toDouble(com.ibm.icu.text.NumberFormat numberFormat,
                                               boolean primitive)
Parameters:
numberFormat -
primitive -
Returns:
to Double converter with the provided numberFormat

toLong

public static 
StringToNumberConverter toLong(boolean primitive)
Parameters:
primitive - true if the convert to type is a long
Returns:
to Long converter for the default locale

toLong

public static 
StringToNumberConverter toLong(com.ibm.icu.text.NumberFormat numberFormat,
                                             boolean primitive)
Parameters:
numberFormat -
primitive -
Returns:
to Long converter with the provided numberFormat

toFloat

public static 
StringToNumberConverter toFloat(boolean primitive)
Parameters:
primitive - true if the convert to type is a float
Returns:
to Float converter for the default locale

toFloat

public static 
StringToNumberConverter toFloat(com.ibm.icu.text.NumberFormat numberFormat,
                                              boolean primitive)
Parameters:
numberFormat -
primitive -
Returns:
to Float converter with the provided numberFormat

toBigInteger

public static 
StringToNumberConverter toBigInteger()
Returns:
to BigInteger converter for the default locale

toBigInteger

public static 
StringToNumberConverter toBigInteger(com.ibm.icu.text.NumberFormat numberFormat)
Parameters:
numberFormat -
Returns:
to BigInteger converter with the provided numberFormat

toBigDecimal

public static 
StringToNumberConverter toBigDecimal()
Returns:
to BigDecimal converter for the default locale
Since:
1.2

toBigDecimal

public static 
StringToNumberConverter toBigDecimal(com.ibm.icu.text.NumberFormat numberFormat)
Parameters:
numberFormat -
Returns:
to BigDecimal converter with the provided numberFormat
Since:
1.2

toShort

public static 
StringToNumberConverter toShort(boolean primitive)
Parameters:
primitive - true if the convert to type is a short
Returns:
to Short converter for the default locale
Since:
1.2

toShort

public static 
StringToNumberConverter toShort(com.ibm.icu.text.NumberFormat numberFormat,
                                              boolean primitive)
Parameters:
numberFormat -
primitive -
Returns:
to Short converter with the provided numberFormat
Since:
1.2

toByte

public static 
StringToNumberConverter toByte(boolean primitive)
Parameters:
primitive - true if the convert to type is a byte
Returns:
to Byte converter for the default locale
Since:
1.2

toByte

public static 
StringToNumberConverter toByte(com.ibm.icu.text.NumberFormat numberFormat,
                                             boolean primitive)
Parameters:
numberFormat -
primitive -
Returns:
to Byte converter with the provided numberFormat
Since:
1.2

Eclipse Platform
Release 3.5

Guidelines for using Eclipse APIs.

Copyright (c) Eclipse contributors and others 2000, 2008. All rights reserved.


 
 
  Published under the terms of the Eclipse Public License Version 1.0 ("EPL") Design by Interspire