How to provide preprocessing instructions in Java

There is already an answer to this question: > how to mark java code such that it's not compiled

[C#]

#define PRODUCTION //Change from sand@R_767_2419@ to production to switch between both systems.

#if SAND@R_767_2419@
    using NetSuite.com.netsuite.sand@R_767_2419@.webservices;
#endif

#if PRODUCTION
    using NetSuite.com.netsuite.webservices;
#endif

Solution

Java doesn't have a preprocessor - so the simple answer is you can't

These things are usually handled using dependency injection (Java), which is more powerful and flexible

http://www.vogella.com/articles/DependencyInjection/article.html

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>