Java Question Wrapper & returning arrays of objects

tchart

Well-Known Member
Licensed User
Longtime User
Im continuing development of a wrapper for a "commercial" library.

The library is large so I have classes in Eclipse for each class in the library.

For example there is a class called Graphic so I have a wrapper called GraphicWrapper

ie public class GraphicWrapper extends AbsObjectWrapper<Graphic>

Now to keep naming conventions in line with the class documentation the short name is the same as the library class name

ie @BA.ShortName("Graphic")

Ive done this so that from B4A I can create a Graphic object in a similar way to how one would in Eclipse.

That all works fine.

My problem is that some other classes return arrays of the wrapped object

eg Graphic[] getGraphics() //Gets the graphics in the set

Ive found that B4A complains that it doesn't know what a "Graphic" is but if I return a "GraphicWrapper" if works. I had some "hacky" code which transferred an array of Graphics to an array of GraphicWrappers and it seemed to work.

Another way around this problem was by returning a B4A "List" of Graphics rather than an array and that works. Something like this;

public List getGraphics()
{
List L = new List();
L.Initialize();
L.getObject.addAll(getObject().getGraphics());
return L;
}

Is there any way to return the actual array without converting the Graphic objects to GraphicWrapper objects?
 
Last edited:
Top