package xyz.danielcortes.framework;

import java.time.DateTimeException;
import java.time.Year;

public class GeneralValidator {
  public static boolean isLong(String number) {
    try {
      Long.parseLong(number);
    } catch (NumberFormatException e) {
      return false;
    }
    return true;
  }

  public static boolean isInteger(String number) {
    try {
      Integer.parseInt(number);
    } catch (NumberFormatException e) {
      return false;
    }
    return true;
  }

  public static boolean isYear(String year) {
    try {
      Year.of(Integer.parseInt(year));
    } catch (NumberFormatException | DateTimeException e) {
      return false;
    }
    return true;
  }
}
