@Test public void convertsReturnedIDToString() { ID helloID = Foundation.cfString("Hello"); Number nativeValue = new Long(helloID.longValue()); String converted = converter.fromNative(nativeValue, null); assertEquals("Hello", converted); if (NativeLong.SIZE == 4) { nativeValue = new Integer(helloID.intValue()); converted = converter.fromNative(nativeValue, null); assertEquals("Hello", converted); } }
public String fromNative(Object nativeValue, FromNativeContext context) { Number nativeValueAsNumber = (Number) nativeValue; if (nativeValueAsNumber == null) { return null; } ID id = ID.fromLong(nativeValueAsNumber.longValue()); if (id.isNull()) { return null; } return Foundation.toString(id); }
StringTypeConverter implements TypeConverter { public String fromNative(Object nativeValue, FromNativeContext context) { Number nativeValueAsNumber = (Number) nativeValue; if (nativeValueAsNumber == null) { return null; } ID id = ID.fromLong(nativeValueAsNumber.longValue()); if (id.isNull()) { return null; } return Foundation.toString(id); } }
StringTypeConverter implements TypeConverter { public String fromNative(Object nativeValue, FromNativeContext context) { Number nativeValueAsNumber = (Number) nativeValue; if (nativeValueAsNumber == null) { return null; } ID id = ID.fromLong(nativeValueAsNumber.longValue()); if (id.isNull()) { return null; } return Foundation.toString(id); }  }
StringTypeConverter implements TypeConverter { public String fromNative(Object nativeValue, FromNativeContext context) { Number nativeValueAsNumber = (Number) nativeValue; if (nativeValueAsNumber == null) { return null; } ID id = ID.fromLong(nativeValueAsNumber.longValue()); if (id.isNull()) { return null; } return Foundation.toString(id); }  Class<?> nativeType(); String fromNative(Object nativeValue, FromNativeContext context); Object toNative(Object value, ToNativeContext context); }
StringTypeConverter implements TypeConverter { public String fromNative(Object nativeValue, FromNativeContext context) { Number nativeValueAsNumber = (Number) nativeValue; if (nativeValueAsNumber == null) { return null; } ID id = ID.fromLong(nativeValueAsNumber.longValue()); if (id.isNull()) { return null; } return Foundation.toString(id); }  Class<?> nativeType(); String fromNative(Object nativeValue, FromNativeContext context); Object toNative(Object value, ToNativeContext context);  }