org.robotframework.javalib.factory
Class CompositeKeywordFactory

java.lang.Object
  extended by org.robotframework.javalib.factory.CompositeKeywordFactory
All Implemented Interfaces:
KeywordFactory<Keyword>

public class CompositeKeywordFactory
extends java.lang.Object
implements KeywordFactory<Keyword>

A composite keyword factory that combines several keyword factories. In case of a conflicting keyword name we register a CollisionKeyword instead of either of the real implementations. When executed, the collision keyword will notify the user of the keyword name conflict.

See Also:
CollisionKeyword

Constructor Summary
CompositeKeywordFactory()
           
 
Method Summary
 void addKeywordFactory(KeywordFactory factory)
          Adds a keyword factory.
 Keyword createKeyword(java.lang.String keywordName)
          Creates an instance of the class implementing the given keyword name
 KeywordFactory[] getKeywordFactories()
          Returns the keyword factories this instance combines
 java.lang.String[] getKeywordNames()
          Returns all the names of the keywords that this factory can create
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CompositeKeywordFactory

public CompositeKeywordFactory()
Method Detail

createKeyword

public Keyword createKeyword(java.lang.String keywordName)
Description copied from interface: KeywordFactory
Creates an instance of the class implementing the given keyword name

Specified by:
createKeyword in interface KeywordFactory<Keyword>
Parameters:
keywordName - keyword name (will be normalized, so pretty much any formatting will do)
Returns:
keyword instance
See Also:
KeywordFactory.createKeyword(String)

getKeywordNames

public java.lang.String[] getKeywordNames()
Description copied from interface: KeywordFactory
Returns all the names of the keywords that this factory can create

Specified by:
getKeywordNames in interface KeywordFactory<Keyword>
Returns:
names of available keywords
See Also:
KeywordFactory.getKeywordNames()

addKeywordFactory

public void addKeywordFactory(KeywordFactory factory)
Adds a keyword factory. After this all the keywords in the given factory can also be instansiated with this CompositeKeywordFactory. Keyword name collision handling explained above in the class description.

Parameters:
factory - factory to add

getKeywordFactories

public KeywordFactory[] getKeywordFactories()
Returns the keyword factories this instance combines

Returns:
array of keyword factories


Copyright © 2009. All Rights Reserved.