由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Java版 - Conditional import in Java
相关主题
get full class nameRe: [转载] Questions on failover & Hot dep
Help!: tomcat classloading problemA very Stupid Question
Re: Help!: tomcat classloading problem请问protected的使用
Java中如何动态生成对象问个问题啊. JDK/JRE
如何获得类定义的public methods?[合集] How to get all classes under a package?
com.sun.tools.javac.Main 问题如何让servlet调用的一些class reload/reinitiate?
java深度历险 阅读笔记 ztOutofMemoryError: Java Heap Space
[转载] servlet调用sql 访问oracle的问题问个java logger的问题
相关话题的讨论汇总
话题: java话题: import话题: gnuio话题: endif
进入Java版参与讨论
1 (共1页)
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.
1 (共1页)
进入Java版参与讨论
相关主题
问个java logger的问题如何获得类定义的public methods?
请教一个有关 inner class 的问题com.sun.tools.javac.Main 问题
dependency version collision problemjava深度历险 阅读笔记 zt
JSP How to Invoke the Specific version of Xerces-J[转载] servlet调用sql 访问oracle的问题
get full class nameRe: [转载] Questions on failover & Hot dep
Help!: tomcat classloading problemA very Stupid Question
Re: Help!: tomcat classloading problem请问protected的使用
Java中如何动态生成对象问个问题啊. JDK/JRE
相关话题的讨论汇总
话题: java话题: import话题: gnuio话题: endif