All Downloads are FREE. Search and download functionalities are using the official Maven repository.

edu.isi.nlp.converters.StringToDouble Maven / Gradle / Ivy

The newest version!
package edu.isi.nlp.converters;

import static com.google.common.base.Preconditions.checkNotNull;

public class StringToDouble implements StringConverter {

  public StringToDouble() {}

  public Class getValueClass() {
    return Double.class;
  }

  @Override
  public Double decode(final String s) {
    try {
      return Double.parseDouble(s);
    } catch (NumberFormatException nfe) {
      throw new ConversionException("Not a double: " + s, checkNotNull(nfe));
    }
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy