Java Code Examples for org.joda.time.Duration#parse()
The following examples show how to use
org.joda.time.Duration#parse() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ParseDuration.java From super-csv with Apache License 2.0 | 6 votes |
/** * {@inheritDoc} * * @throws SuperCsvCellProcessorException * if value is null or is not a String */ public Object execute(final Object value, final CsvContext context) { validateInputNotNull(value, context); if (!(value instanceof String)) { throw new SuperCsvCellProcessorException(String.class, value, context, this); } final Duration result; try { result = Duration.parse((String) value); } catch (IllegalArgumentException e) { throw new SuperCsvCellProcessorException( "Failed to parse value as a Duration", context, this, e); } return next.execute(result, context); }
Example 2
Source File: DurationTranslatorFactory.java From nomulus with Apache License 2.0 | 5 votes |
@Override protected SimpleTranslator<Duration, String> createTranslator() { return new SimpleTranslator<Duration, String>() { @Override public Duration loadValue(String datastoreValue) { return Duration.parse(datastoreValue); } @Override public String saveValue(Duration pojoValue) { return pojoValue.toString(); }}; }
Example 3
Source File: DurationFormatter.java From spring-analysis-note with MIT License | 4 votes |
@Override public Duration parse(String text, Locale locale) throws ParseException { return Duration.parse(text); }
Example 4
Source File: DurationFormatter.java From java-technology-stack with MIT License | 4 votes |
@Override public Duration parse(String text, Locale locale) throws ParseException { return Duration.parse(text); }
Example 5
Source File: DurationFormatter.java From lams with GNU General Public License v2.0 | 4 votes |
@Override public Duration parse(String text, Locale locale) throws ParseException { return Duration.parse(text); }
Example 6
Source File: DurationConverter.java From arctic-sea with Apache License 2.0 | 4 votes |
@Override public Duration convert(String source) { return Duration.parse(source); }
Example 7
Source File: DurationFormatter.java From spring4-understanding with Apache License 2.0 | 4 votes |
@Override public Duration parse(String text, Locale locale) throws ParseException { return Duration.parse(text); }
Example 8
Source File: StreamingDataflowWorkerOptions.java From beam with Apache License 2.0 | 4 votes |
@Override public Duration create(PipelineOptions options) { Duration period = Duration.parse(System.getProperty("windmill.harness_update_reporting_period", "PT10S")); return period.isLongerThan(Duration.ZERO) ? period : Duration.standardSeconds(10); }
Example 9
Source File: StreamingDataflowWorkerOptions.java From beam with Apache License 2.0 | 4 votes |
@Override public Duration create(PipelineOptions options) { Duration period = Duration.parse(System.getProperty("windmill.global_get_config_refresh_period", "PT120S")); return period.isLongerThan(Duration.ZERO) ? period : Duration.standardMinutes(2); }
Example 10
Source File: Adapters.java From activitystreams with Apache License 2.0 | 4 votes |
public Duration apply(String v) { return Duration.parse(v); }
Example 11
Source File: DurationConverter.java From gson-jodatime-serialisers with MIT License | 3 votes |
/** * 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()); }