int versionParts; for (versionParts = 0; versionParts < 3; versionParts++) { Number part = (Number) numformat.parseObject(serverVersion, parsepos); if (part == null) { break;
public Object parseObject(final String _source, final ParsePosition _pos) { return fmt_.parseObject(_source, _pos); }
private double parseDecimal(String latitude) throws ParseException { return ((Number) NumberFormat.getInstance().parseObject(latitude)) .doubleValue(); }
private double parseDecimal(String latitude) throws ParseException { return ((Number) NumberFormat.getInstance().parseObject(latitude)) .doubleValue(); }
public Object parse(String formattedValue) throws Exception { ParsePosition parsePosition = new ParsePosition(0); Object o = nf.parseObject(formattedValue,parsePosition); if (parsePosition.getIndex() != formattedValue.length()) { throw new RuntimeException("Invalid number "+formattedValue); } return o; //Double.parseDouble(formattedValue); }
public Object parse(String formattedValue) throws Exception { ParsePosition parsePosition = new ParsePosition(0); Object o = nf.parseObject(formattedValue); if (parsePosition.getIndex() != formattedValue.length()) { throw new RuntimeException("Invalid number "+formattedValue); } return o; }
public Object parse(String formattedValue) throws Exception { ParsePosition parsePosition = new ParsePosition(0); Object o = nf.parseObject(formattedValue); if (parsePosition.getIndex() != formattedValue.length()) { throw new RuntimeException("Invalid number "+formattedValue); } return o; }
public Object parse(String formattedValue) throws Exception { ParsePosition parsePosition = new ParsePosition(0); Object o = nf.parseObject(formattedValue); if (parsePosition.getIndex() != formattedValue.length()) { throw new RuntimeException("Invalid number "+formattedValue); } return o; }
public Object parse(String formattedValue) throws Exception { ParsePosition parsePosition = new ParsePosition(0); Object o = nf.parseObject(formattedValue); if (parsePosition.getIndex() != formattedValue.length()) { throw new RuntimeException("Invalid number "+formattedValue); } return o; }
public Object parse(String formattedValue) throws Exception { ParsePosition parsePosition = new ParsePosition(0); Object o = nf.parseObject(formattedValue); if (parsePosition.getIndex() != formattedValue.length()) { throw new RuntimeException("Invalid number "+formattedValue); } return o; }
public Object parse(String formattedValue) throws Exception { ParsePosition parsePosition = new ParsePosition(0); Object o = nf.parseObject(formattedValue,parsePosition); if (parsePosition.getIndex() != formattedValue.length()) { throw new RuntimeException("Invalid number "+formattedValue); } return o; }
public Object parse(String formattedValue) throws Exception { ParsePosition parsePosition = new ParsePosition(0); Object o = nf.parseObject(formattedValue); if (parsePosition.getIndex() != formattedValue.length()) { throw new RuntimeException("Invalid number "+formattedValue); } return o; }
public Object parse(String formattedValue) throws Exception { ParsePosition parsePosition = new ParsePosition(0); Object o = nf.parseObject(formattedValue,parsePosition); if (parsePosition.getIndex() != formattedValue.length()) { throw new RuntimeException("Invalid number "+formattedValue); } return o; //Double.parseDouble(formattedValue); }
private Double parseValue(String value) throws ArgsException { if (value == null) { return null; } try { Number number = (Number) valueFormat.parseObject(value); return number.doubleValue(); } catch (ParseException e) { throw log.errorParseValue(e, value); } }
@Override public Number parse(final String source, final ParsePosition parsePosition) { return myInverseFunc.invoke((N) myFormat.parseObject(source, parsePosition)); }
public static boolean tryParse(String s, int[] result) { NumberFormat format = NumberFormat.getIntegerInstance(); ParsePosition position = new ParsePosition(0); Object parsedValue = format.parseObject(s, position); if (position.getErrorIndex() > -1) { return false; } if (position.getIndex() < s.length()) { return false; } result[0] = ((Long) parsedValue).intValue(); return true; }
/** * {@inheritDoc}<p> * * If {@code source} is empty or whitespace, the <em>emptyValue</em> * is returned. Otherwise parsing is forwarded to the delegate * - indirectly via {@link #parse(String, ParsePosition)}. */ @Override public Object parseObject(String source) throws ParseException { return Strings.isBlank(source) ? emptyValue : super.parseObject(source); }
@Override public Number parse(final String source, final ParsePosition parsePosition) { return myInverseFunc.invoke((N) myFormat.parseObject(source, parsePosition)); }
@Override public Object parseObject(String source, ParsePosition pos) { if (source.isEmpty()) { pos.setIndex(1); return Integer.valueOf(minValue); } Object val = numberFormat.parseObject(source, pos); if (pos.getIndex() != source.length()) { pos.setErrorIndex(pos.getIndex()); pos.setIndex(0); } return val; } }
@Override public Object getCellEditorValue() { JFormattedTextField ftf = (JFormattedTextField) getComponent(); Object o = ftf.getValue(); if (o instanceof Integer) { return o; } else if (o instanceof Number) { return new Integer(((Number) o).intValue()); } else { try { return integerFormat.parseObject(o.toString()); } catch (ParseException ex) { LOGGER.log(Level.FINE, "getCellEditorValue: can't parse {0}", o); return null; } } }