@Override protected Object doRestore(final String data) { return new Color(Integer.parseInt(data, 16)); }
@Override protected Object doRestore(final String data) { return new Color(Integer.parseInt(data, 16)); }
public Object nullSafeGet(final ResultSet rs, final String[] names, final Object owner) throws HibernateException, SQLException { int color = rs.getInt(names[0]); if (rs.wasNull()) return null; return new Color(color); }
@Override protected Object doParse(final Object original, final String text) { try { if (text.startsWith("0x")) { return new Color(Integer.parseInt(text.substring(2), 16)); } else if (text.startsWith("#")) { return new Color(Integer.parseInt(text.substring(1), 16)); } else { return new Color(Integer.parseInt(text)); } } catch (final NumberFormatException e) { throw new TextEntryParseException("Not a number " + text, e); } }
@Override protected Object doParse(final Object original, final String text) { try { if (text.startsWith("0x")) { return new Color(Integer.parseInt(text.substring(2), 16)); } else if (text.startsWith("#")) { return new Color(Integer.parseInt(text.substring(1), 16)); } else { return new Color(Integer.parseInt(text)); } } catch (final NumberFormatException e) { throw new TextEntryParseException("Not a number " + text, e); } }
public NakedObject createValue(final NakedObject object, final int colorAsInt) { final Color color = new Color(colorAsInt); return getRuntimeContext().adapterFor(color); }
public NakedObject createValue(final NakedObject object, final int colorAsInt) { final Color color = new Color(colorAsInt); return getRuntimeContext().adapterFor(color); }
public void testNullSafeSetNotNull() throws Exception { final int value = 5; final Color color = new Color(value); final MockControl<PreparedStatement> control = MockControl.createControl(PreparedStatement.class); final PreparedStatement ps = (PreparedStatement) control.getMock(); ps.setInt(1, value); control.replay(); // finished recording final ColorType type = new ColorType(); type.nullSafeSet(ps, color, 1); control.verify(); }
public void testToTitle() throws Exception { assertEquals("Black", Color.BLACK.title()); assertEquals("White", Color.WHITE.title()); assertEquals("#fe231d", new Color(0xfe231D).title()); }