i**p 发帖数: 902 | 1 Is there something like this in Java? Thanks!
#if GNUIO
import gnu.io.*;
#else
import javax.comm.*;
#endif |
h*****0 发帖数: 4889 | 2 No.
May I ask why do you want this? I may have solutions to achieve what you
want.
【在 i**p 的大作中提到】 : Is there something like this in Java? Thanks! : #if GNUIO : import gnu.io.*; : #else : import javax.comm.*; : #endif
|
k***r 发帖数: 4260 | 3 可以在两个library之间Z turn。不过如果class/method不能一一对应的话,
好像也Z Turn不起来呀
【在 h*****0 的大作中提到】 : No. : May I ask why do you want this? I may have solutions to achieve what you : want.
|
g*****g 发帖数: 34805 | 4 No, but you can implement your own classloader.
【在 i**p 的大作中提到】 : Is there something like this in Java? Thanks! : #if GNUIO : import gnu.io.*; : #else : import javax.comm.*; : #endif
|
m******t 发帖数: 2416 | 5
The common practice in Java is to define a wrapper interface,
and implementations delegating to these packages.
You could also completely avoid importing these classes
and rely on dynamic classloading and call the methods
reflectively, but I wouldn't do that unless there are no
other choices.
【在 i**p 的大作中提到】 : Is there something like this in Java? Thanks! : #if GNUIO : import gnu.io.*; : #else : import javax.comm.*; : #endif
|
j****y 发帖数: 10 | 6 pre-processor for java.
you may wanna try it. |