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

com.carrotsearch.console.jcommander.converters.BaseConverter Maven / Gradle / Ivy

There is a newer version: 1.1.4
Show newest version
/*
 * console-tools
 *
 * Copyright (C) 2019, Carrot Search s.c.
 * All rights reserved.
 */
package com.carrotsearch.console.jcommander.converters;

import com.carrotsearch.console.jcommander.IStringConverter;

/**
 * Base class for converters that stores the name of the option.
 *
 * @author cbeust
 */
public abstract class BaseConverter implements IStringConverter {

  private String m_optionName;

  public BaseConverter(String optionName) {
    m_optionName = optionName;
  }

  public String getOptionName() {
    return m_optionName;
  }

  protected String getErrorString(String value, String to) {
    return "\"" + getOptionName() + "\": couldn't convert \"" + value + "\" to " + to;
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy