Bool.java 1.29 KB
/*
 * Decompiled with CFR 0_118.
 */
package com.adobe.xfa;

import com.adobe.xfa.EnumAttr;
import com.adobe.xfa.EnumValue;
import com.adobe.xfa.ut.ExFull;
import com.adobe.xfa.ut.MsgFormatPos;
import com.adobe.xfa.ut.ResId;
import com.adobe.xfa.ut.StringUtils;

public final class Bool {
    public static EnumAttr falseValue() {
        return EnumAttr.getEnum(1074003968);
    }

    public static EnumAttr getBool(boolean bValue) {
        if (bValue) {
            return Bool.trueValue();
        }
        return Bool.falseValue();
    }

    public static EnumAttr getBool(String sValue) {
        if (StringUtils.isEmpty(sValue) || sValue.equals("0")) {
            return Bool.falseValue();
        }
        if (sValue.equals("1")) {
            return Bool.trueValue();
        }
        MsgFormatPos msg = new MsgFormatPos(ResId.InvalidPropertyValueException, sValue);
        msg.format("boolean");
        throw new ExFull(msg);
    }

    public static boolean getValue(EnumAttr e) {
        return e.getInt() == 1074003969;
    }

    public static boolean getValue(EnumValue e) {
        return e.getInt() == 1074003969;
    }

    public static String toString(boolean b) {
        return b ? "1" : "0";
    }

    public static EnumAttr trueValue() {
        return EnumAttr.getEnum(1074003969);
    }
}