public static RetentionValue parse()

in src/main/java/com/google/gcs/sdrs/common/RetentionValue.java [61:85]


  public static RetentionValue parse(String retentionValue) {

    if (retentionValue == null) {
      return null;
    }

    String[] tokens = retentionValue.split(":");
    if (tokens.length == 2) {
      String numberStr = tokens[0];
      String unitTypeStr = tokens[1];
      Integer number = null;
      try {
        number = Integer.parseInt(numberStr);
      } catch (NumberFormatException e) {
        return null;
      }
      RetentionUnitType unitType = RetentionUnitType.getType(unitTypeStr);
      if (unitType == null) {
        return null;
      }
      return new RetentionValue(number, unitType);
    } else {
      return null;
    }
  }