@Override public Duration parse(String text, Locale locale) throws ParseException { return Duration.parse(text); }
@Override public Duration parse(String text, Locale locale) throws ParseException { return Duration.parse(text); }
Duration duration = Duration.parse(text);
Duration duration = Duration.parse(text);
protected Duration _deserialize(DeserializationContext ctxt, String str) throws IOException { if (str.length() == 0) { if (ctxt.isEnabled(DeserializationFeature.ACCEPT_EMPTY_STRING_AS_NULL_OBJECT)) { return null; } } return Duration.parse(str); } }
@Override public Duration convert(String source) { return Duration.parse(source); }
@Override public Duration parse(String text, Locale locale) throws ParseException { return Duration.parse(text); }
@Override public void setAsText(String text) throws IllegalArgumentException { this.setValue(Duration.parse(text)); } }
/** * Gson invokes this call-back method during deserialization when it encounters a field of the * specified type. * <p> * In the implementation of this call-back method, you should consider invoking * {@link JsonDeserializationContext#deserialize(JsonElement, Type)} method to create objects * for any non-trivial field of the returned object. However, you should never invoke it on the * the same type passing {@code json} since that will cause an infinite loop (Gson will call your * call-back method again). * @param json The Json data being deserialized * @param typeOfT The type of the Object to deserialize to * @return a deserialized object of the specified type typeOfT which is a subclass of {@code T} * @throws JsonParseException if json is not in the expected format of {@code typeOfT} */ @Override public Duration deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { // Do not try to deserialize null or empty values if (json.getAsString() == null || json.getAsString().isEmpty()) { return null; } return Duration.parse(json.getAsString()); } }
/** * Get duration property. * * @since 3.0.4 */ @Nullable public static Duration getDuration(final Properties properties, final String name) { String value = getString(properties, name); if (value != null) { try { return Duration.parse(value); } catch (IllegalArgumentException e) { log.warn("Invalid duration property: {}={}", name, value); } } return null; } }
implements Callable<ValueType> { private static final Duration WAIT_DURATION = Duration.parse("PT3S");
return Duration.parse(value); } else { final Matcher matcher = DURATION_PATTERN.matcher(value);
public static List<Timeout<Command>> findTimers(IndexedProcessDefinition pd, ProcessElementCommand cmd) throws ExecutionException { List<BoundaryEvent> events = ProcessDefinitionUtils.findOptionalBoundaryEvents(pd, cmd.getElementId()); List<Timeout<Command>> l = new ArrayList<>(events.size()); for (BoundaryEvent ev : events) { if (ev.getTimeDuration() != null) { Duration d = Duration.parse(ev.getTimeDuration()); Command c = new ProcessElementCommand(pd.getId(), ev.getId()); l.add(new Timeout<>(d.getMillis(), c)); } } l.sort((o1, o2) -> (int) (o1.getDuration() - o2.getDuration())); return l; }
Duration duration = Duration.parse(text);
Duration duration = Duration.parse(text);