15 messages in net.java.dev.jna.usersRe: [jna-users] Override Pointer.fina...
FromSent OnAttachments
bb...@cox.netJun 26, 2007 9:11 am 
Timothy WallJun 26, 2007 12:52 pm 
Wayne MeissnerJun 26, 2007 7:43 pm 
Ben ChaseJun 26, 2007 8:39 pm 
Wayne MeissnerJun 26, 2007 10:33 pm 
Timothy WallJun 27, 2007 5:08 am 
Timothy WallJun 27, 2007 5:20 am 
Rick GoldsteinJun 27, 2007 8:50 am 
Timothy WallJun 27, 2007 9:59 am 
Ben ChaseJun 27, 2007 7:26 pm 
Timothy WallJun 28, 2007 3:56 am 
bb...@cox.netJun 28, 2007 4:43 am 
bb...@cox.netJun 28, 2007 5:37 am 
bb...@cox.netJun 28, 2007 6:18 am 
Wayne MeissnerJun 28, 2007 7:41 am 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:Re: [jna-users] Override Pointer.finalize to reclaim Native resources?Actions...
From:Timothy Wall (twal@dev.java.net)
Date:Jun 27, 2007 5:20:49 am
List:net.java.dev.jna.users

On Jun 27, 2007, at 1:34 AM, Wayne Meissner wrote:

Assuming img looks like: class ImageHandle { Pointer handle; }

This way, you get the added type safety of specific java classes (instead of using Pointer everywhere) without having to extend Pointer (and having to work-around package-private constructors like you did).

Unless you really need/want users to be able to access the Pointer methods (like readInt, writeInt, etc), I recommend delegation over inheritance when wrapping a C/C++ api like that.

It makes for a cleaner API, and doesn't clutter up code-completion/ intellisense with a bazillion methods you don't need.

I agree with Wayne on this one; delegation seems a better usage than inheritance. None of the Pointer methods have anything to do with your application/API object, and would likely just clutter any API you design for it.

The current state of member/class access is not written in stone, but mostly as restrictive as possible to communicate to the user which classes they really need to be looking at. We're trying to drive the API by actual usage, which unfortunately is limited right now to Wayne's gstreamer work and my various experiments with various w32 and X11 APIs.