public static Integer parse(String str) throws NumberFormatException {

        // Return null if no value provided
        if (str == null || str.isEmpty())
            return null;

        // Parse as integer
        return Integer.valueOf(str);

    }
Parses the given string as an integer, where the given string is in the
format required by a numeric field.

@param str
    The string to parse as an integer, which may be null.

@return
    The integer representation of the given string, or null if the given
    string was null.

@throws NumberFormatException
    If the given string is not in a parseable format.
guacamole-ext/src/main/java/org/apache/guacamole/form/NumericField.java