54 lines
2.2 KiB
Java
54 lines
2.2 KiB
Java
package com.thoughtworks.xstream.converters.extended;
|
|
|
|
import com.thoughtworks.xstream.converters.basic.AbstractSingleValueConverter;
|
|
import java.util.Calendar;
|
|
import java.util.Date;
|
|
|
|
/* loaded from: classes.dex */
|
|
public class ISO8601DateConverter extends AbstractSingleValueConverter {
|
|
static /* synthetic */ Class class$java$util$Date;
|
|
static /* synthetic */ Class class$java$util$GregorianCalendar;
|
|
private final ISO8601GregorianCalendarConverter converter = new ISO8601GregorianCalendarConverter();
|
|
|
|
static /* synthetic */ Class class$(String str) {
|
|
try {
|
|
return Class.forName(str);
|
|
} catch (ClassNotFoundException e) {
|
|
throw new NoClassDefFoundError().initCause(e);
|
|
}
|
|
}
|
|
|
|
@Override // com.thoughtworks.xstream.converters.basic.AbstractSingleValueConverter, com.thoughtworks.xstream.converters.ConverterMatcher
|
|
public boolean canConvert(Class cls) {
|
|
Class cls2 = class$java$util$Date;
|
|
if (cls2 == null) {
|
|
cls2 = class$("java.util.Date");
|
|
class$java$util$Date = cls2;
|
|
}
|
|
if (cls == cls2) {
|
|
ISO8601GregorianCalendarConverter iSO8601GregorianCalendarConverter = this.converter;
|
|
Class cls3 = class$java$util$GregorianCalendar;
|
|
if (cls3 == null) {
|
|
cls3 = class$("java.util.GregorianCalendar");
|
|
class$java$util$GregorianCalendar = cls3;
|
|
}
|
|
if (iSO8601GregorianCalendarConverter.canConvert(cls3)) {
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
@Override // com.thoughtworks.xstream.converters.basic.AbstractSingleValueConverter, com.thoughtworks.xstream.converters.SingleValueConverter
|
|
public Object fromString(String str) {
|
|
return ((Calendar) this.converter.fromString(str)).getTime();
|
|
}
|
|
|
|
@Override // com.thoughtworks.xstream.converters.basic.AbstractSingleValueConverter, com.thoughtworks.xstream.converters.SingleValueConverter
|
|
public String toString(Object obj) {
|
|
Calendar calendar = Calendar.getInstance();
|
|
calendar.setTime((Date) obj);
|
|
return this.converter.toString(calendar);
|
|
}
|
|
}
|