@Override protected Integer doForward(String value) { return Integer.decode(value); }
@Override protected Integer doForward(String value) { return Integer.decode(value); }
/** * <p>Convert a <code>String</code> to a <code>Integer</code>, handling * hex and octal notations.</p> * * @param val a <code>String</code> to convert * @return converted <code>Integer</code> * @throws NumberFormatException if the value cannot be converted */ public static Integer createInteger(String val) { // decode() handles 0xAABD and 0777 (hex and octal) as well. return Integer.decode(val); }
@Override protected Integer doForward(String value) { return Integer.decode(value); }
/** * <p>Convert a <code>String</code> to a <code>Integer</code>, handling * hex (0xhhhh) and octal (0dddd) notations. * N.B. a leading zero means octal; spaces are not trimmed.</p> * * <p>Returns <code>null</code> if the string is <code>null</code>.</p> * * @param str a <code>String</code> to convert, may be null * @return converted <code>Integer</code> (or null if the input is null) * @throws NumberFormatException if the value cannot be converted */ public static Integer createInteger(final String str) { if (str == null) { return null; } // decode() handles 0xAABD and 0777 (hex and octal) as well. return Integer.decode(str); }
/** * <p>Convert a <code>String</code> to a <code>Integer</code>, handling * hex and octal notations.</p> * * <p>Returns <code>null</code> if the string is <code>null</code>.</p> * * @param str a <code>String</code> to convert, may be null * @return converted <code>Integer</code> * @throws NumberFormatException if the value cannot be converted */ public static Integer createInteger(String str) { if (str == null) { return null; } // decode() handles 0xAABD and 0777 (hex and octal) as well. return Integer.decode(str); }
/** * Constructor used by Ant's introspection mechanism for attribute population * @param value the value to decode */ public FlexInteger(String value) { this.value = Integer.decode(value); }
@Nullable protected Integer asNumber(String val) { try { return Integer.decode(val); } catch (NumberFormatException e) { return null; } }
public Integer parseValue(final String string, final ClassLoader classLoader) throws IllegalArgumentException { return Integer.decode(string.trim()); } });
/** * 将16进制的String转化为Integer. * * 当str为空或非数字字符串时抛NumberFormatException */ public static Integer hexToIntObject(@NotNull String str) { // 统一行为,不要有时候抛NPE,有时候抛NumberFormatException if (str == null) { throw new NumberFormatException("null"); } return Integer.decode(str); }
@Override public void startElement(String uri, String localName, String qName, Attributes attr) throws SAXException { if (qName.equals("public")) { String resourceType = attr.getValue("type"); String resourceName = attr.getValue("name").replace('.', '_'); Integer resourceId = Integer.decode(attr.getValue("id")); String qualifiedResourceName = String.format("%s.%s.%s", prefix, resourceType, resourceName); resourceIds.put(resourceId, qualifiedResourceName); } } });
/** * 将16进制的String转化为Integer,出错时返回默认值. */ public static Integer hexToIntObject(@Nullable String str, Integer defaultValue) { if (StringUtils.isEmpty(str)) { return defaultValue; } try { return Integer.decode(str); } catch (final NumberFormatException nfe) { return defaultValue; } }
public Integer getInteger(String query, String hintName) { String value = (String) hintsMap.get( hintName ); if ( value == null ) { return null; } try { return Integer.decode( value ); } catch ( NumberFormatException nfe ) { throw new AnnotationException( "Not an integer in hint: " + query + ":" + hintName, nfe ); } }
private long getDefaultMaxLength() { return 1L << Integer.decode(parse(name)[0]).intValue(); }
/** * Returns the value as an int. * * @param columnIndex (1,2,...) * @return the value */ @Override public int getInt(int columnIndex) throws SQLException { Object o = get(columnIndex); if (o != null && !(o instanceof Number)) { o = Integer.decode(o.toString()); } return o == null ? 0 : ((Number) o).intValue(); }
public static Color decode(String nm) throws NumberFormatException { Integer intval = Integer.decode(nm); int i = intval; return new Color((i >> 16) & 0xFF, (i >> 8) & 0xFF, i & 0xFF); } }
private int parseInt(String value, String key) { try { return Integer.decode(value).intValue(); } catch (NumberFormatException e) { throw createNumberFormatException("number", value, key); } }
return Integer.decode(v); } catch (NumberFormatException e) {
/** * Get the setting for the given key. * * @param key the key * @param defaultValue the default value * @return the setting */ protected int get(String key, int defaultValue) { String s = get(key, "" + defaultValue); try { return Integer.decode(s); } catch (NumberFormatException e) { throw DbException.get(ErrorCode.DATA_CONVERSION_ERROR_1, e, "key:" + key + " value:" + s); } }
/** * Get the value of the given property. * * @param setting the setting id * @param defaultValue the default value * @return the value as an integer */ int getIntProperty(int setting, int defaultValue) { String key = SetTypes.getTypeName(setting); String s = getProperty(key, null); try { return s == null ? defaultValue : Integer.decode(s); } catch (NumberFormatException e) { return defaultValue; } }