|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.robotframework.javalib.library.KeywordFactoryBasedLibrary<Keyword>
org.robotframework.javalib.library.ClassPathLibrary
public class ClassPathLibrary
A Robot keyword library that finds keywords dynamically from the classpath.
To add keywords to the library, first make sure that the pattern and
package prefix are correct. The pattern is used to find potential
keywords according to their name. E.g. if your class name is
com.acme.mycomponent.keyword.DoSomething and you want it
to be registered as a keyword, the keyword pattern could be
com/**/keyword/**/**.class. Try to
set it as restrictive as possible in order to avoid keyword name collisions
with other libraries using javalib-core. For example, it is perhaps not
a good idea to set it to com/**/**.class.
The pattern is resolved by PathMatchingResourcePatternResolver.
The package prefix is used to determine the class path location of the class from the filesystem path. Do not use it for filtering out keywords, that's what the pattern is for. The package prefix must match for all keywords the pattern finds. The default package prefix is "org.".
Then make sure your keyword fills all the requirements of
InterfaceBasedKeywordFilter.
After that, all you need to do is to add your keywords to your class path and this library will automatically find them. Contents of JAR files are also searched.
| Constructor Summary | |
|---|---|
ClassPathLibrary()
|
|
ClassPathLibrary(java.lang.String keywordPattern)
|
|
| Method Summary | |
|---|---|
protected KeywordFactory<Keyword> |
createKeywordFactory()
Creates a keyword factory. |
void |
setKeywordPattern(java.lang.String pattern)
Sets a new pattern. |
| Methods inherited from class org.robotframework.javalib.library.KeywordFactoryBasedLibrary |
|---|
getClassLoader, getKeywordNames, runKeyword, setClassLoader |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ClassPathLibrary()
public ClassPathLibrary(java.lang.String keywordPattern)
| Method Detail |
|---|
protected KeywordFactory<Keyword> createKeywordFactory()
KeywordFactoryBasedLibraryKeywordFactoryBasedLibrary.getKeywordNames() or KeywordFactoryBasedLibrary.runKeyword(String, Object[])
is called for the first time.
createKeywordFactory in class KeywordFactoryBasedLibrary<Keyword>public void setKeywordPattern(java.lang.String pattern)
RobotJavaLibrary.runKeyword(String, Object[]) or
RobotJavaLibrary.getKeywordNames().
pattern - new pattern
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||