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

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

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

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

public class StringToInteger implements StringConverter {

  public StringToInteger() {}

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

  @Override
  public Integer decode(final String s) {
    try {
      return Integer.parseInt(checkNotNull(s));
    } catch (NumberFormatException nfe) {
      throw new ConversionException("Not an integer: " + s, nfe);
    }
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy