// Path: lib-core/src/main/java/xdroid/core/Global.java
// public static Context getContext() {
//     if (sContext == null) {
//         sContext = CurrentApplicationHolder.INSTANCE;
//     }
// 
//     return notNull(sContext);
// }
// 
// Path: lib-core/src/main/java/xdroid/core/Global.java
// public static Resources getResources() {
//     return notNull(getContext().getResources());
// }


import java.text.FieldPosition;
import java.text.Format;
import java.text.ParsePosition;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import static xdroid.core.Global.getContext;
import static xdroid.core.Global.getResources;
    @SuppressWarnings("NullableProblems")
    public StringBuffer format(Object object, StringBuffer buffer, FieldPosition field) {
        if (object instanceof Enum) {
            Enum e = (Enum) object;

            int stringId = getStringId(e);
            if (stringId != 0) {
                buffer.append(getResources().getText(stringId));
            } else {
                buffer.append(e.name());
            }

            return buffer;
        }

        throw new IllegalArgumentException(String.valueOf(object));
    }

    protected int getStringId(Enum e) {
        String fullName = e.getClass().getName() + "." + e.name();

        Integer result = getCache(fullName);
        if (result != null) {
            return result;
        }

        EnumString a = getAnnotation(e);
        if (a != null) {
            result = a.value();
        } else {
// Path: lib-core/src/main/java/xdroid/core/Global.java
// public static Context getContext() {
//     if (sContext == null) {
//         sContext = CurrentApplicationHolder.INSTANCE;
//     }
// 
//     return notNull(sContext);
// }
// 
// Path: lib-core/src/main/java/xdroid/core/Global.java
// public static Resources getResources() {
//     return notNull(getContext().getResources());
// }


// Path: lib-enum-format/src/main/java/xdroid/enumformat/EnumFormat.java
import java.text.FieldPosition;
import java.text.Format;
import java.text.ParsePosition;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import static xdroid.core.Global.getContext;
import static xdroid.core.Global.getResources;

    @SuppressWarnings("NullableProblems")
    public StringBuffer format(Object object, StringBuffer buffer, FieldPosition field) {
        if (object instanceof Enum) {
            Enum e = (Enum) object;

            int stringId = getStringId(e);
            if (stringId != 0) {
                buffer.append(getResources().getText(stringId));
            } else {
                buffer.append(e.name());
            }

            return buffer;
        }

        throw new IllegalArgumentException(String.valueOf(object));
    }

    protected int getStringId(Enum e) {
        String fullName = e.getClass().getName() + "." + e.name();

        Integer result = getCache(fullName);
        if (result != null) {
            return result;
        }

        EnumString a = getAnnotation(e);
        if (a != null) {
            result = a.value();
        } else {
            result = getResources().getIdentifier(e.name().toLowerCase(Locale.US), "string", getContext().getPackageName());