Posted By:
Asawari_Joglekar
Posted On:
Tuesday, May 14, 2002 09:57 AM
p>Hi, I'm new to Java and I have a problem about some basic stuff. I have a library that contains all the classes with names starting with "XX" like, XXObject, XXFoo, XXBar etc... I can not change names of these. The client for this library uses class names starting with YY, like YYObject, YYFoo, YYBar etc. Interface of XX* and YY* match exactly. But I am not allowed to change code from client or library containing XX* objects. What I need to do is to write a wrapper so that client can talk to library. Parts of client code looks like this : YYFoo = new YYFoo(); // creating new String s = YYFoo.g
More>>
p>Hi,
I'm new to Java and I have a problem about some basic stuff.
I have a library that contains all the classes with names starting with "XX" like,
XXObject, XXFoo, XXBar etc... I can not change names of these.
The client for this library uses class names starting with YY, like
YYObject, YYFoo, YYBar etc.
Interface of XX* and YY* match exactly. But I am not allowed to change code from client or library containing XX* objects.
What I need to do is to write a wrapper so that client can talk to library.
Parts of client code looks like this :
YYFoo = new YYFoo(); // creating new
String s = YYFoo.getStaticString(); // calling static function
Y
YBar bar = yyfoo.doSomething(yyStuff, someString,yySomething); // yyfoo is object of type YYFoo, yyStuff is object of type YYStuff and yySomething is object of type YYSomething
I assume my wrapper would contain all YY* classes which would forward each public function call to proper XX* functions.
In C/C++ this was achievable by writing a header file containing lines
typedef XXObject YYObject;
typedef XXFoo YYFoo; ...
But how to do it in Java with little effort (that can be automated using scripting)
Thanx for the help
AJ
<<Less