public static int toInt(String str) { return toInt(str, INTEGER_ERROR); }
public static double toDouble(String str) { return toDouble(str, DOUBLE_ERROR); }
public static float toFloat(String str) { return toFloat(str, FLOAT_ERROR); }
return (not ? !answer : answer); else if (resultValue instanceof Number && NumberUtils.isDigits(compareTo)) boolean answer = NumberUtils.createNumber(compareTo).equals(resultValue); return (not ? !answer : answer);
if (NumberUtils.isDigits(portSystemVar))
@Override public Object doTransform(Object src, String outputEncoding) throws TransformerException { if (src == null) { return null; } else { if (numberFormat != null) { try { return NumberUtils.convertNumberToTargetClass(numberFormat.parse((String) src), getReturnClass()); } catch (Exception e) { throw new TransformerException(this, e); } } else { return NumberUtils.parseNumber((String) src, getReturnClass()); } } }
if (value < Byte.MIN_VALUE || value > Byte.MAX_VALUE) raiseOverflowException(number, targetClass); if (value < Short.MIN_VALUE || value > Short.MAX_VALUE) raiseOverflowException(number, targetClass); if (value < Integer.MIN_VALUE || value > Integer.MAX_VALUE) raiseOverflowException(number, targetClass);
private static MagentoException toMagentoException(final AxisFault fault) { final String faultCode = fault.getFaultCode().toString(); if (NumberUtils.isNumber(faultCode)) { return new MagentoException(Integer.parseInt(faultCode), fault.getFaultString(), fault); } else { return new MagentoException(MagentoException.UNKNOWN_ERROR, fault.getFaultString(), fault); } }
public void initialise() throws InitialisationException { super.initialise(); if (localPort == null) { String portSystemVar = System.getProperty("http.port"); if (NumberUtils.isDigits(portSystemVar)) { localPort = Integer.parseInt(portSystemVar); } else { LOGGER.warn("Environment variable 'http.port' not found, using default localPort: 8080"); localPort = 8080; } } if (remotePort == null) { LOGGER.info("Using default remotePort: 80"); remotePort = 80; } if (domain == null) { String domainSystemVar = System.getProperty("fullDomain"); if (domainSystemVar!= null) { domain = domainSystemVar; } else { LOGGER.warn("Environment variable 'fullDomain' not found, using default: localhost"); domain = "localhost"; } } }
public static int toInt(Object obj) { if (obj == null) { throw new IllegalArgumentException("Unable to convert null object to int"); } else if (obj instanceof String) { return toInt((String) obj); } else if (obj instanceof Number) { return ((Number) obj).intValue(); } else { throw new IllegalArgumentException("Unable to convert object of type: " + obj.getClass().getName() + " to int."); } }
public static float toFloat(Object obj) { if (obj == null) { throw new IllegalArgumentException("Unable to convert null object to float"); } else if (obj instanceof String) { return toFloat((String) obj); } else if (obj instanceof Number) { return ((Number) obj).floatValue(); } else { throw new IllegalArgumentException("Unable to convert object of type: " + obj.getClass().getName() + " to float."); } }
public static double toDouble(Object obj) { if (obj == null) { throw new IllegalArgumentException("Unable to convert null object to double"); } else if (obj instanceof String) { return toDouble((String) obj); } else if (obj instanceof Number) { return ((Number) obj).doubleValue(); } else { throw new IllegalArgumentException("Unable to convert object of type: " + obj.getClass().getName() + " to double."); } }
private Integer resolveStatusCode(MuleEvent event) { if (statusCode != null) { return statusCodeEvaluator.resolveIntegerValue(event); } Object statusCodeOutboundProperty = event.getMessage().getOutboundProperty(HTTP_STATUS_PROPERTY); if (statusCodeOutboundProperty != null) { return NumberUtils.toInt(statusCodeOutboundProperty); } return null; }