private void handleInitMethod(Object result) { // Normally init methods return self, but on error they may return nil. // In this case the ObjC object for which this is the handler is considered // freed and should not be released when we are finalized. if (result != null) return; ocInstance = ID.fromLong(0); }
public IDByReference() { this(ID.fromLong(0)); }
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); }
public T 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; boolean shouldRetain = shouldRetainFor(context); return Rococoa.wrap(id, javaType, shouldRetain); }
@Override public Object readFrom(Memory buffer, Class<?> type) { ID id = ID.fromLong(buffer.getNativeLong(0).longValue()); if (id.isNull()) return null; return id; } @Override public Memory bufferForResult(Object methodCallResult) {
public ID getValue() { return ID.fromLong(getPointer().getNativeLong(0).longValue()); }
@Override public Object readFrom(Memory buffer, Class<?> type) { ID id = ID.fromLong(buffer.getNativeLong(0).longValue()); if (id.isNull()) return null; return Foundation.toString(id); } @Override public Memory bufferForResult(Object methodCallResult) {
@SuppressWarnings("unchecked") @Override public Object readFrom(Memory buffer, Class<?> type) { ID id = ID.fromLong(buffer.getNativeLong(0).longValue()); if (id.isNull()) return null; return Rococoa.wrap(id, (Class<? extends ObjCObject>) type); } @Override public Memory bufferForResult(Object methodCallResult) {