Package com.sun.javatest
Class Keywords
- java.lang.Object
-
- com.sun.javatest.Keywords
-
public abstract class Keywords extends java.lang.Object
A filter for sets of keywords, as found on test descriptions.- See Also:
TestDescription.getKeywordTable()
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Keywords.Fault
An exception used to report errors while using a Keywords object.
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
ALL_OF
A constant to indicate that all of a list of keywords should be matched.static java.lang.String
ANY_OF
A constant to indicate that any of a list of keywords should be matched.static java.lang.String
EXPR
A constant to indicate that an expression keyword should be matched.protected java.lang.String
text
-
Constructor Summary
Constructors Constructor Description Keywords()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract boolean
accepts(java.util.Set s)
Check if this keywords object accepts, or matches, the specified set of words.static Keywords
create(java.lang.String type, java.lang.String text)
Create a keywords object.static Keywords
create(java.lang.String type, java.lang.String text, java.util.Set validKeywords)
Create a keywords object.java.lang.String
getSummary()
Get a human digestable version of the kw represented by this object.static void
setAllowNumericKeywords(boolean allowNumericKeywords)
Allow keywords to begin with a numeric or not.
-
-
-
Field Detail
-
text
protected java.lang.String text
-
ALL_OF
public static final java.lang.String ALL_OF
A constant to indicate that all of a list of keywords should be matched.- See Also:
- Constant Field Values
-
ANY_OF
public static final java.lang.String ANY_OF
A constant to indicate that any of a list of keywords should be matched.- See Also:
- Constant Field Values
-
EXPR
public static final java.lang.String EXPR
A constant to indicate that an expression keyword should be matched.- See Also:
- Constant Field Values
-
-
Method Detail
-
create
public static Keywords create(java.lang.String type, java.lang.String text) throws Keywords.Fault
Create a keywords object.- Parameters:
type
- one of ALL_OF, ANY_OF, or EXPRtext
- if the type is one of "all of" or "any of", text should be a white-space separated list of keywords; if type is "expr", text should be a boolean valued expression formed from keywords, '&' (and), '|' (or), '!' (not) and '(' ')' (parentheses).- Returns:
- A Keywords object for the specified type and text.
- Throws:
Keywords.Fault
- if there are errors in the arguments.
-
create
public static Keywords create(java.lang.String type, java.lang.String text, java.util.Set validKeywords) throws Keywords.Fault
Create a keywords object.- Parameters:
type
- one of ALL_OF, ANY_OF, or EXPRtext
- if the type is one of "all of" or "any of", text should be a white-space separated list of keywords; if type is "expr", text should be a boolean valued expression formed from keywords, '&' (and), '|' (or), '!' (not) and '(' ')' (parentheses).validKeywords
- a set of valid keywords for this test suite, or null. If not null, all the keywords in text must be in this set.- Returns:
- A Keywords object for the specified type and text.
- Throws:
Keywords.Fault
- if there are errors in the arguments.
-
getSummary
public java.lang.String getSummary()
Get a human digestable version of the kw represented by this object.- Returns:
- Human readable, fully descriptive rendering of current kw setting
-
setAllowNumericKeywords
public static void setAllowNumericKeywords(boolean allowNumericKeywords)
Allow keywords to begin with a numeric or not.- Parameters:
allowNumericKeywords
- Value to be set.
-
accepts
public abstract boolean accepts(java.util.Set s)
Check if this keywords object accepts, or matches, the specified set of words. If the keywords type is "any of" or "all of", the set must have any or of all of the words specified in the keywords object; if the keywords type is "expr", the given expression must evaluate to true, when the words in the expression are true if they are present in the given set of words.- Parameters:
s
- A set of words to compare against the keywords object.- Returns:
- true if the the specified set of words are compatible with this keywords object.
-
-