下面列出了java.time.Period#toString ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
@Override
public String convertToDolphin(final Period value) throws ValueConverterException{
if(value == null) {
return null;
}
try {
return value.toString();
} catch (Exception e) {
throw new ValueConverterException("Can not convert from Periode", e);
}
}
/**
* {@inheritDoc}
*
* @throws SuperCsvCellProcessorException if value is null or not a Period
*/
public Object execute(final Object value, final CsvContext context) {
validateInputNotNull(value, context);
if( !(value instanceof Period) ) {
throw new SuperCsvCellProcessorException(Period.class, value, context, this);
}
final Period period = (Period) value;
final String result = period.toString();
return next.execute(result, context);
}
@Override
public String convert(Period period) {
String result = null;
if (log.isTraceEnabled()) {
log.trace("Converting Period {} to string", period.toString());
}
result = period.toString();
return result;
}
@Override
public String print(Period object, Locale locale) {
return object.toString();
}
public static String convertPeriod(Period period) {
return period != null ? period.toString() : null;
}
@Override
public String convertToDatabaseColumn(Period attribute) {
return attribute.toString();
}
@Override
public String print(Period object, Locale locale) {
return object.toString();
}
@Override
public String print(Period object, Locale locale) {
return object.toString();
}
@Override
public String print(Period object, Locale locale) {
return object.toString();
}
@Override
public String marshal(Period value) {
return value != null ? value.toString() : null;
}
@Override
public String serialize(Period sourceValue) {
return sourceValue.toString();
}
/**
* Creates a periodic frequency.
*
* @param period the period to represent
*/
private Frequency(Period period) {
this(period, period.toString());
}