Re: creating named objects...
Per Nyfelt <[email protected]> Fri, 31 Dec 2004 11:26:35 +0100
| Newsgroups | gmane.comp.java.ozone.user |
|---|---|
| Organization | Resourcing Networks |
| Message-ID | <[email protected]> |
Hi Nicolas,
See my answers below.
fredagen den 31 december 2004 05.19 skrev Nicolas Barrera:
> sorry i m asking again...., i ve been searching all night 'bout how to
> create a named object on the mail list and i d no luck...
>
> i mean, i imagine it can be created through the
> Databes.createObject(java.lang.Class type, int access,
> java.lang.String objName)
> method...
>
> but my client app is trying to create a database object through the
> factory... and there i got a
> ImplFactory.create( [the params needed for constructor] )
> method.. which do not specify object's name on creation... then i
> can't use the objectForName(String) method to lookup :(
You can use nameObject(...) on the OzoneInterace to do name objects. Read the
users guide about factories and you'll seen that there are better ways as
well ;)...
>
> the client is using the Factory class to create an instance because i
> found it quite difficult to figure out how do i need to pass the
> constructor signature on the method...:
>
> createObject(java.lang.String className, int access, java.lang.String
> objName, java.lang.String sig, java.lang.Object[] args)
>
Assuming an Auto object has a constructor like the foillowing:
public AutoImpl(String foo, int i)
An Auto is created as follows:
auto = (Auto)db.createObject( "AutoImpl",
OzoneInterface.Public,
"auto",
"String|int",
new Object[] {"bla", new Integer(123)}
);
> or the method...
>
> createObject(java.lang.Class type, int access, java.lang.String
> objName, java.lang.Class[] sig, java.lang.Object[] args)
auto = (Auto)db.createObject( AutoImpl.class,
OzoneInterface.Public,
"auto",
new Class[] {String.class, int.class},
new Object[] {"bla", new Integer(123)}
);
See the Users guide for a more thourough explanation.
Best regards,
Per
>
> i imagine the Object[] args... but not the sig...
>
> hope you could help me out with this... :D
>
> thanks in advance... (for your patience ;P)
> c ya!
>
>
> -------------------------------------------------------
> The SF.Net email is sponsored by: Beat the post-holiday blues
> Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
> It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt
> _______________________________________________
> Ozone-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/ozone-users
-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues
Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt