Java Code Examples for org.joda.time.Duration#toString()

The following examples show how to use org.joda.time.Duration#toString() . 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: DurationTranslatorFactory.java    From nomulus with Apache License 2.0 5 votes vote down vote up
@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 2
Source File: FmtDuration.java    From super-csv with Apache License 2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 * 
 * @throws SuperCsvCellProcessorException
 *             if value is null or not a Duration
 */
public Object execute(final Object value, final CsvContext context) {
	validateInputNotNull(value, context);
	if (!(value instanceof Duration)) {
		throw new SuperCsvCellProcessorException(Duration.class, value,
				context, this);
	}
	final Duration duration = (Duration) value;
	final String result = duration.toString();
	return next.execute(result, context);
}
 
Example 3
Source File: DurationFormatter.java    From spring-analysis-note with MIT License 4 votes vote down vote up
@Override
public String print(Duration object, Locale locale) {
	return object.toString();
}
 
Example 4
Source File: DurationFormatter.java    From java-technology-stack with MIT License 4 votes vote down vote up
@Override
public String print(Duration object, Locale locale) {
	return object.toString();
}
 
Example 5
Source File: DurationFormatter.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
@Override
public String print(Duration object, Locale locale) {
	return object.toString();
}
 
Example 6
Source File: DurationFormatter.java    From spring4-understanding with Apache License 2.0 4 votes vote down vote up
@Override
public String print(Duration object, Locale locale) {
	return object.toString();
}
 
Example 7
Source File: JodaDurationObjectFactory.java    From ldp4j with Apache License 2.0 4 votes vote down vote up
@Override
public String toString(Duration value) {
	return value.toString();
}
 
Example 8
Source File: StringColumnDurationMapper.java    From jadira with Apache License 2.0 4 votes vote down vote up
@Override
public String toNonNullValue(Duration value) {
    return value.toString();
}
 
Example 9
Source File: IntegerColumnDurationMapper.java    From jadira with Apache License 2.0 4 votes vote down vote up
@Override
public String toNonNullString(Duration value) {
    return value.toString();
}
 
Example 10
Source File: BigIntegerColumnDurationMapper.java    From jadira with Apache License 2.0 4 votes vote down vote up
@Override
public String toNonNullString(Duration value) {
    return value.toString();
}
 
Example 11
Source File: LongColumnDurationMapper.java    From jadira with Apache License 2.0 4 votes vote down vote up
@Override
public String toNonNullString(Duration value) {
    return value.toString();
}
 
Example 12
Source File: DurationConverter.java    From gson-jodatime-serialisers with MIT License 2 votes vote down vote up
/**
 * Gson invokes this call-back method during serialization when it encounters a field of the
 * specified type.
 * <p>
 * In the implementation of this call-back method, you should consider invoking
 * {@link com.google.gson.JsonSerializationContext#serialize(Object, java.lang.reflect.Type)} method to create JsonElements for any
 * non-trivial field of the {@code src} object. However, you should never invoke it on the
 * {@code src} object itself since that will cause an infinite loop (Gson will call your
 * call-back method again).
 * @param src the object that needs to be converted to Json.
 * @param typeOfSrc the actual type (fully genericized version) of the source object.
 * @return a JsonElement corresponding to the specified object.
 */
@Override
public JsonElement serialize(Duration src, Type typeOfSrc, JsonSerializationContext context)
{
  return new JsonPrimitive(src.toString());
}