简体   繁体   English

用关键字包装Java方法

[英]Java method wrapping with keywords

I am writing a Java keyword driven framework. 我正在编写一个Java关键字驱动的框架。 In that I have one keyword Java class which I am calling in another Java test class. 因为我有一个关键字Java类,正在另一个Java测试类中调用它。

KeywordClass doactionobje = new KeywordClasss();
doactionObje.click(parameter1,...);

Now I am looking to wrap this method calling in single keyword. 现在,我希望将这种方法包装在单个关键字中。 For eg doactionObje.click should be only click similar doactionobje.input to only input . 例如, doactionObje.click应该仅click类似doactionobje.input ,仅click input

New code will look like 新代码看起来像

click parameter1, parameter2

I want to achieve this to make test script writing easier for those who do not have much coding experience. 我想实现这一点,以使那些没有太多编码经验的人更容易编写测试脚本。

I would also like to know about your thoughts on performance of script execution and other maintenance over ahead. 我还想知道您对脚本执行性能和以后其他维护的想法。

The directive you might be looking for is import static , ie 您可能正在寻找的指令是import static ,即

import static java.util.Collections.*; 

will import all the static methods from the java.util.Collections class. 将从java.util.Collections类导入所有静态方法。 However, there is no way to do this for non-static methods. 但是,非静态方法无法执行此操作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM