![JAR search and dependency download from the Maven repository](/logo.png)
com.g2forge.alexandria.java.enums.EnumPrefixedString Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ax-java Show documentation
Show all versions of ax-java Show documentation
Standard Java library and the basis of the ${alexandria.name} project.
package com.g2forge.alexandria.java.enums;
import lombok.Getter;
@Getter
public class EnumPrefixedString> {
public static > EnumPrefixedString parse(E unspecified, String separator, String string) {
final int index = string.indexOf(separator);
if (index < 0) return new EnumPrefixedString<>(unspecified, separator, string);
else {
final E value = HEnum.valueOfInsensitive(unspecified.getDeclaringClass(), string.substring(0, index));
return new EnumPrefixedString<>(value, separator, string.substring(index + separator.length()));
}
}
protected final E value;
protected final String separator;
protected final String string;
public EnumPrefixedString(E unspecified, String separator, String string) {
this.value = unspecified;
this.separator = separator;
this.string = string;
}
@Override
public String toString() {
return value.toString() + separator + string;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy