public Range(Dictionary<String, ?> range) { if (range == null) { throw new IllegalArgumentException("range is null."); } Object startRange = range.get(START_KEY); Object endRange = range.get(END_KEY); if (startRange == null) { throw new IllegalArgumentException(START_KEY + " is required."); } if (endRange == null) { throw new IllegalArgumentException(END_KEY + " is required."); } if (startRange instanceof String) { this.start = Time.decode((String)startRange); } else { this.start = (Time)startRange; } if (endRange instanceof String) { this.end = Time.decode((String)endRange); } else { this.end = (Time)endRange; } }
public Range(Dictionary<String, ?> range) { if (range == null) { throw new IllegalArgumentException("range is null."); } Object start = range.get(START_KEY); Object end = range.get(END_KEY); if (start == null) { throw new IllegalArgumentException(START_KEY + " is required."); } if (end == null) { throw new IllegalArgumentException(END_KEY + " is required."); } if (start instanceof String) { this.start = Time.decode((String)start); } else { this.start = (Time)start; } if (end instanceof String) { this.end = Time.decode((String)end); } else { this.end = (Time)end; } }
public static Range decode(String value) { if (value == null) { throw new IllegalArgumentException(); } Range range; if (value.startsWith("{")) { try { range = new Range(JSONSerializer.parseMap(value)); } catch (SerializationException exception) { throw new IllegalArgumentException(exception); } } else { range = new Range(Time.decode(value)); } return range; } }
public static Range decode(String value) { if (value == null) { throw new IllegalArgumentException(); } Range range; if (value.startsWith("{")) { try { range = new Range(JSONSerializer.parseMap(value)); } catch (SerializationException exception) { throw new IllegalArgumentException(exception); } } else { range = new Range(Time.decode(value)); } return range; } }