Initial commit
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
package com.thoughtworks.xstream.converters.extended;
|
||||
|
||||
import com.thoughtworks.xstream.converters.basic.AbstractSingleValueConverter;
|
||||
import javax.xml.datatype.DatatypeConfigurationException;
|
||||
import javax.xml.datatype.DatatypeFactory;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class DurationConverter extends AbstractSingleValueConverter {
|
||||
static /* synthetic */ Class class$javax$xml$datatype$Duration;
|
||||
private final DatatypeFactory factory;
|
||||
|
||||
/* JADX WARN: Type inference failed for: r0v0, types: [com.thoughtworks.xstream.converters.extended.DurationConverter$1] */
|
||||
public DurationConverter() {
|
||||
this(new Object() { // from class: com.thoughtworks.xstream.converters.extended.DurationConverter.1
|
||||
DatatypeFactory getFactory() {
|
||||
try {
|
||||
return DatatypeFactory.newInstance();
|
||||
} catch (DatatypeConfigurationException unused) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}.getFactory());
|
||||
}
|
||||
|
||||
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) {
|
||||
if (this.factory != null && cls != null) {
|
||||
Class cls2 = class$javax$xml$datatype$Duration;
|
||||
if (cls2 == null) {
|
||||
cls2 = class$("javax.xml.datatype.Duration");
|
||||
class$javax$xml$datatype$Duration = cls2;
|
||||
}
|
||||
if (cls2.isAssignableFrom(cls)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.converters.basic.AbstractSingleValueConverter, com.thoughtworks.xstream.converters.SingleValueConverter
|
||||
public Object fromString(String str) {
|
||||
return this.factory.newDuration(str);
|
||||
}
|
||||
|
||||
public DurationConverter(DatatypeFactory datatypeFactory) {
|
||||
this.factory = datatypeFactory;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user