Forums > Java

How to know when attribute processing is done, even with no attributes specified

April 18, 2012 | 2:01 pm

Hi all,

In the C API there is the attr_args_process function that I call to process the attributes entered in an object box. In Java this happens automatically, from what I can see sometime after the constructor of the object has completed.

I would however like to know when the processing of attributes is complete, so that I can take action if an attribute has -not- been specified. Is there a function that can notify me when this has been done?

Many thanks,

April 18, 2012 | 8:35 pm

Off the top of my head, I would be inclined to initialize _all_ values at the beginning of the new() method (before attribute processing happens), then let the attribute processing handle any overrides specified by @attribute parameters in the object initialization.

Yeah, so some attibutes may be set up twice (first to the default and then by the user override with an @attribute). Are you in that much of a hurry to worry about it?-)

Or am I missing something?

April 19, 2012 | 9:55 am

Hi Peter!

Thanks for your reply. In this case initializing the attributes twice is exactly what I want to try to prevent. I’m working on my networking objects and depending on the attribute a server socket is initialized. Preferably I wouldn’t do that twice.

Btw I found a workaround for now: setting a Qelem at the end of the constructor to call my init method. It looks like the attribute setting has been done once the queue reaches it.


April 19, 2012 | 8:43 pm

Hi Mattijs,

there is another way- probably more reliable:

declare the attribute with a custom getter and setter methods. When the object is instantiated the setter will be called with the right right attribute value.


April 20, 2012 | 9:02 am

Hi Jan,

Thanks for your reply, although I think you misunderstood the problem; I do have custom getters and setters, but I need to know when they are called during the initialization sequence..


Viewing 5 posts - 1 through 5 (of 5 total)

Forums > Java