package com.thoughtworks.xstream.converters.basic; import com.tencent.bugly.Bugly; /* loaded from: classes.dex */ public class BooleanConverter extends AbstractSingleValueConverter { static /* synthetic */ Class class$java$lang$Boolean; private final boolean caseSensitive; private final String negative; private final String positive; public static final BooleanConverter TRUE_FALSE = new BooleanConverter("true", Bugly.SDK_IS_DEV, false); public static final BooleanConverter YES_NO = new BooleanConverter("yes", "no", false); public static final BooleanConverter BINARY = new BooleanConverter("1", "0", true); public BooleanConverter(String str, String str2, boolean z) { this.positive = str; this.negative = str2; this.caseSensitive = z; } 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 (cls != Boolean.TYPE) { Class cls2 = class$java$lang$Boolean; if (cls2 == null) { cls2 = class$("java.lang.Boolean"); class$java$lang$Boolean = cls2; } if (cls != cls2) { return false; } } return true; } @Override // com.thoughtworks.xstream.converters.basic.AbstractSingleValueConverter, com.thoughtworks.xstream.converters.SingleValueConverter public Object fromString(String str) { return this.caseSensitive ? this.positive.equals(str) ? Boolean.TRUE : Boolean.FALSE : this.positive.equalsIgnoreCase(str) ? Boolean.TRUE : Boolean.FALSE; } public boolean shouldConvert(Class cls, Object obj) { return true; } @Override // com.thoughtworks.xstream.converters.basic.AbstractSingleValueConverter, com.thoughtworks.xstream.converters.SingleValueConverter public String toString(Object obj) { Boolean bool = (Boolean) obj; if (obj == null) { return null; } return bool.booleanValue() ? this.positive : this.negative; } public BooleanConverter() { this("true", Bugly.SDK_IS_DEV, false); } }