コード例 #1
0
ファイル: TypeAdapter.java プロジェクト: irudyak/ant-toolkit
  private Long parseLong(String value) throws IllegalArgumentException {
    if (value == null || value.trim().length() == 0) {
      return null;
    }

    try {
      return Long.parseLong(value);
    } catch (NumberFormatException e) {
      throw new IllegalArgumentException("Invalid long value '" + value + "' specified");
    }
  }
コード例 #2
0
ファイル: TypeAdapter.java プロジェクト: irudyak/ant-toolkit
  private Date parseDate(String value) throws IllegalArgumentException {
    if (value == null || value.trim().length() == 0) {
      return null;
    }

    try {
      return getDateFormat().parse(value);
    } catch (ParseException e) {
    }

    try {
      return new Date(Long.parseLong(value));
    } catch (NumberFormatException e) {
    }

    throw new IllegalArgumentException("Invalid date value '" + value + "' specified");
  }
コード例 #3
0
 public void setTimeToWait(int timeToWait) {
   this.timeToWait = timeToWait;
   project.setProperty("timeToWait", Long.toString(timeToWait));
 }