175 lines
7.2 KiB
Java
175 lines
7.2 KiB
Java
package com.google.common.base;
|
|
|
|
import java.io.Serializable;
|
|
|
|
/* JADX WARN: Enum visitor error
|
|
jadx.core.utils.exceptions.JadxRuntimeException: Init of enum field 'LOWER_UNDERSCORE' uses external variables
|
|
at jadx.core.dex.visitors.EnumVisitor.createEnumFieldByConstructor(EnumVisitor.java:451)
|
|
at jadx.core.dex.visitors.EnumVisitor.processEnumFieldByField(EnumVisitor.java:372)
|
|
at jadx.core.dex.visitors.EnumVisitor.processEnumFieldByWrappedInsn(EnumVisitor.java:337)
|
|
at jadx.core.dex.visitors.EnumVisitor.extractEnumFieldsFromFilledArray(EnumVisitor.java:322)
|
|
at jadx.core.dex.visitors.EnumVisitor.extractEnumFieldsFromInsn(EnumVisitor.java:262)
|
|
at jadx.core.dex.visitors.EnumVisitor.convertToEnum(EnumVisitor.java:151)
|
|
at jadx.core.dex.visitors.EnumVisitor.visit(EnumVisitor.java:100)
|
|
*/
|
|
/* JADX WARN: Failed to restore enum class, 'enum' modifier and super class removed */
|
|
/* loaded from: classes.dex */
|
|
public abstract class CaseFormat {
|
|
private static final /* synthetic */ CaseFormat[] $VALUES;
|
|
public static final CaseFormat LOWER_CAMEL;
|
|
public static final CaseFormat LOWER_HYPHEN = new CaseFormat("LOWER_HYPHEN", 0, CharMatcher.c('-'), "-") { // from class: com.google.common.base.CaseFormat.1
|
|
@Override // com.google.common.base.CaseFormat
|
|
String convert(CaseFormat caseFormat, String str) {
|
|
return caseFormat == CaseFormat.LOWER_UNDERSCORE ? str.replace('-', '_') : caseFormat == CaseFormat.UPPER_UNDERSCORE ? Ascii.b(str.replace('-', '_')) : super.convert(caseFormat, str);
|
|
}
|
|
|
|
@Override // com.google.common.base.CaseFormat
|
|
String normalizeWord(String str) {
|
|
return Ascii.a(str);
|
|
}
|
|
};
|
|
public static final CaseFormat LOWER_UNDERSCORE;
|
|
public static final CaseFormat UPPER_CAMEL;
|
|
public static final CaseFormat UPPER_UNDERSCORE;
|
|
private final CharMatcher wordBoundary;
|
|
private final String wordSeparator;
|
|
|
|
private static final class StringConverter extends Converter<String, String> implements Serializable {
|
|
private final CaseFormat b;
|
|
private final CaseFormat c;
|
|
|
|
StringConverter(CaseFormat caseFormat, CaseFormat caseFormat2) {
|
|
Preconditions.a(caseFormat);
|
|
this.b = caseFormat;
|
|
Preconditions.a(caseFormat2);
|
|
this.c = caseFormat2;
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: protected */
|
|
@Override // com.google.common.base.Converter
|
|
/* renamed from: a, reason: merged with bridge method [inline-methods] */
|
|
public String c(String str) {
|
|
return this.b.to(this.c, str);
|
|
}
|
|
|
|
@Override // com.google.common.base.Function
|
|
public boolean equals(Object obj) {
|
|
if (!(obj instanceof StringConverter)) {
|
|
return false;
|
|
}
|
|
StringConverter stringConverter = (StringConverter) obj;
|
|
return this.b.equals(stringConverter.b) && this.c.equals(stringConverter.c);
|
|
}
|
|
|
|
public int hashCode() {
|
|
return this.b.hashCode() ^ this.c.hashCode();
|
|
}
|
|
|
|
public String toString() {
|
|
return this.b + ".converterTo(" + this.c + ")";
|
|
}
|
|
}
|
|
|
|
static {
|
|
String str = "_";
|
|
LOWER_UNDERSCORE = new CaseFormat("LOWER_UNDERSCORE", 1, CharMatcher.c('_'), str) { // from class: com.google.common.base.CaseFormat.2
|
|
@Override // com.google.common.base.CaseFormat
|
|
String convert(CaseFormat caseFormat, String str2) {
|
|
return caseFormat == CaseFormat.LOWER_HYPHEN ? str2.replace('_', '-') : caseFormat == CaseFormat.UPPER_UNDERSCORE ? Ascii.b(str2) : super.convert(caseFormat, str2);
|
|
}
|
|
|
|
@Override // com.google.common.base.CaseFormat
|
|
String normalizeWord(String str2) {
|
|
return Ascii.a(str2);
|
|
}
|
|
};
|
|
String str2 = "";
|
|
LOWER_CAMEL = new CaseFormat("LOWER_CAMEL", 2, CharMatcher.a('A', 'Z'), str2) { // from class: com.google.common.base.CaseFormat.3
|
|
@Override // com.google.common.base.CaseFormat
|
|
String normalizeWord(String str3) {
|
|
return CaseFormat.firstCharOnlyToUpper(str3);
|
|
}
|
|
};
|
|
UPPER_CAMEL = new CaseFormat("UPPER_CAMEL", 3, CharMatcher.a('A', 'Z'), str2) { // from class: com.google.common.base.CaseFormat.4
|
|
@Override // com.google.common.base.CaseFormat
|
|
String normalizeWord(String str3) {
|
|
return CaseFormat.firstCharOnlyToUpper(str3);
|
|
}
|
|
};
|
|
UPPER_UNDERSCORE = new CaseFormat("UPPER_UNDERSCORE", 4, CharMatcher.c('_'), str) { // from class: com.google.common.base.CaseFormat.5
|
|
@Override // com.google.common.base.CaseFormat
|
|
String convert(CaseFormat caseFormat, String str3) {
|
|
return caseFormat == CaseFormat.LOWER_HYPHEN ? Ascii.a(str3.replace('_', '-')) : caseFormat == CaseFormat.LOWER_UNDERSCORE ? Ascii.a(str3) : super.convert(caseFormat, str3);
|
|
}
|
|
|
|
@Override // com.google.common.base.CaseFormat
|
|
String normalizeWord(String str3) {
|
|
return Ascii.b(str3);
|
|
}
|
|
};
|
|
$VALUES = new CaseFormat[]{LOWER_HYPHEN, LOWER_UNDERSCORE, LOWER_CAMEL, UPPER_CAMEL, UPPER_UNDERSCORE};
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public static String firstCharOnlyToUpper(String str) {
|
|
if (str.isEmpty()) {
|
|
return str;
|
|
}
|
|
return Ascii.c(str.charAt(0)) + Ascii.a(str.substring(1));
|
|
}
|
|
|
|
private String normalizeFirstWord(String str) {
|
|
return this == LOWER_CAMEL ? Ascii.a(str) : normalizeWord(str);
|
|
}
|
|
|
|
public static CaseFormat valueOf(String str) {
|
|
return (CaseFormat) Enum.valueOf(CaseFormat.class, str);
|
|
}
|
|
|
|
public static CaseFormat[] values() {
|
|
return (CaseFormat[]) $VALUES.clone();
|
|
}
|
|
|
|
String convert(CaseFormat caseFormat, String str) {
|
|
int i = 0;
|
|
StringBuilder sb = null;
|
|
int i2 = -1;
|
|
while (true) {
|
|
i2 = this.wordBoundary.a(str, i2 + 1);
|
|
if (i2 == -1) {
|
|
break;
|
|
}
|
|
if (i == 0) {
|
|
sb = new StringBuilder(str.length() + (this.wordSeparator.length() * 4));
|
|
sb.append(caseFormat.normalizeFirstWord(str.substring(i, i2)));
|
|
} else {
|
|
sb.append(caseFormat.normalizeWord(str.substring(i, i2)));
|
|
}
|
|
sb.append(caseFormat.wordSeparator);
|
|
i = this.wordSeparator.length() + i2;
|
|
}
|
|
if (i == 0) {
|
|
return caseFormat.normalizeFirstWord(str);
|
|
}
|
|
sb.append(caseFormat.normalizeWord(str.substring(i)));
|
|
return sb.toString();
|
|
}
|
|
|
|
public Converter<String, String> converterTo(CaseFormat caseFormat) {
|
|
return new StringConverter(this, caseFormat);
|
|
}
|
|
|
|
abstract String normalizeWord(String str);
|
|
|
|
public final String to(CaseFormat caseFormat, String str) {
|
|
Preconditions.a(caseFormat);
|
|
Preconditions.a(str);
|
|
return caseFormat == this ? str : convert(caseFormat, str);
|
|
}
|
|
|
|
private CaseFormat(String str, int i, CharMatcher charMatcher, String str2) {
|
|
this.wordBoundary = charMatcher;
|
|
this.wordSeparator = str2;
|
|
}
|
|
}
|