Converts the given attribute to an integer value.
974920
public static Optional<Integer> asIntegerValue(Attribute a) {
    class Visitor extends SimpleAnnotationValueVisitor8<Integer, Void> {
      @Override
      public Integer visitInt(int i, Void unused) {
        return i;
      }
    }
    return Optional.ofNullable(a.accept(new Visitor(), null));
  }
67072
def to_int(value: Any) -> int:
        

        if isinstance(value, (bool, int)):
            return int(value)
        return int(str(value))
339980
def integer(
        element_name,  # type: Text
        attribute=None,  # type: Optional[Text]
        required=True,  # type: bool
        alias=None,  # type: Optional[Text]
        default=0,  # type: Optional[int]
        omit_empty=False,  # type: bool
        hooks=None  # type: Optional[Hooks]
):
    # type: (...) -> Processor
    
    value_parser = _number_parser(int)
    return _PrimitiveValue(
        element_name,
        value_parser,
        attribute,
        required,
        alias,
        default,
        omit_empty,
        hooks
    )
68128
private Object parseAttributeValue(XAttribute xAttribute) {
		String attributeString = xAttribute.toString();

		// TODO better solution?

		// All numeric values as double
		try {
			double a = Double.parseDouble(attributeString);
			return a;
		} catch (NumberFormatException e) {
			// Ignore
		}
		// Boolean
		if (attributeString.trim().toLowerCase().equals("true"))
			return true;
		if (attributeString.trim().toLowerCase().equals("false"))
			return false;
		// String
		return attributeString;
	}
971952
public static Integer isInteger(String value) {
		Validate.notNull(value);
		Validate.notEmpty(value);
		Integer intValue = null;
		try{
			intValue = 	Integer.parseInt(value);
		} catch(NumberFormatException e){
			throw new TypeException("Integer");
		}
		return intValue;
	}
804317
public static Integer toInteger(Object o, Integer defaultValue) {
	if (defaultValue != null) return Integer.valueOf(toIntValue(o, defaultValue.intValue()));
	int res = toIntValue(o, Integer.MIN_VALUE);
	if (res == Integer.MIN_VALUE) return defaultValue;
	return Integer.valueOf(res);
    }
555231
public BigDecimalAttribute plus(BigDecimalAttribute attribute)
    {
        return BigDecimalNumericType.getInstance().createCalculatedAttribute(BigDecimalNumericType.getInstance().createAdditionCalculator(this, attribute));
    }
1049942
public static final int getInt(String value)
   {
      return (value == null || value.length() == 0 ? 0 : Integer.parseInt(value));
   }
784257
public Integer getIntObject(String attributeName) {
        String val = get(attributeName, null);
        if (val != null) {
            return Integer.valueOf(val);
        }
        return null;
    }
951885
def convert_attrs_to_int(obj: Any,
                         attrs: Iterable[str],
                         default: int = None) -> None:
    
    for a in attrs:
        value = convert_to_int(getattr(obj, a), default=default)
        setattr(obj, a, value)
1232249
private static double doubleValue(Object attributeValue)
         throws NumberFormatException {

        if (attributeValue instanceof Number) {
            return (((Number) attributeValue).doubleValue());
        } else {
            return (Double.parseDouble(attributeValue.toString()));
        }

    }
482915
public int toInt(Element el, String attributeName) {
	return Caster.toIntValue(el.getAttribute(attributeName), Integer.MIN_VALUE);
    }
674656
protected Integer getIntFromRangeElement(String attribute) {
        Element ele = $(rangeInputElement).asElement();
        if (ele != null) {
            return ele.getPropertyInt(attribute);
        }
        return null;
    }
1274625
static Integer convertToInt(Object a, int type) {

        int value;

        if (a instanceof Integer) {
            if (type == Types.SQL_INTEGER) {
                return (Integer) a;
            }

            value = ((Integer) a).intValue();
        } else if (a instanceof Long) {
            long temp = ((Long) a).longValue();

            if (Integer.MAX_VALUE < temp || temp < Integer.MIN_VALUE) {
                throw Error.error(ErrorCode.X_22003);
            }

            value = (int) temp;
        } else if (a instanceof BigDecimal) {
            BigDecimal bd = ((BigDecimal) a);

            if (bd.compareTo(MAX_INT) > 0 || bd.compareTo(MIN_INT) < 0) {
                throw Error.error(ErrorCode.X_22003);
            }

            value = bd.intValue();
        } else if (a instanceof Double || a instanceof Float) {
            double d = ((Number) a).doubleValue();

            if (Double.isInfinite(d) || Double.isNaN(d)
                    || d >= (double) Integer.MAX_VALUE + 1
                    || d <= (double) Integer.MIN_VALUE - 1) {
                throw Error.error(ErrorCode.X_22003);
            }

            value = (int) d;
        } else {
            throw Error.error(ErrorCode.X_42561);
        }

        if (type == Types.TINYINT) {
            if (Byte.MAX_VALUE < value || value < Byte.MIN_VALUE) {
                throw Error.error(ErrorCode.X_22003);
            }
        } else if (type == Types.SQL_SMALLINT) {
            if (Short.MAX_VALUE < value || value < Short.MIN_VALUE) {
                throw Error.error(ErrorCode.X_22003);
            }
        }

        return ValuePool.getInt(value);
    }
1311167
@Api
	public void getValue(String name, IntegerAttribute attribute) {
		attribute.setValue(toInteger(formWidget.getValue(name)));
	}
18512
public static int toInteger(Object value, int defaultValue) {
		if (value == null || value.toString().trim().equals("")) {
			return defaultValue;
		}
		if (value instanceof Integer) {
			return (Integer) value;
		}
		return (int) JKConversionUtil.toDouble(value);
	}
218876
protected void setIntToRangeElement(String attribute, Integer val) {
        Element ele = $(rangeInputElement).asElement();
        if (ele != null) {
            ele.setPropertyInt(attribute, val);
        }
    }