|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.lonniepryor.blues.util.Parameters
Specification interface for identifying ordered sequences of Types. Instances of this class may be logically combined using the AND, OR, and NOT operations. Instances may also be sequentially constructed using the Builder class. Many common use-cases are supplied via static accessor methods.
Nested Class Summary | |
static class |
Parameters.Builder
Helper class for sequentially constructing the elements of a common TokenizedStrings specification. |
Constructor Summary | |
protected |
Parameters()
Creates a new Parameters object. |
Method Summary | |
Parameters |
and(Parameters specification)
Returns a specification representing a logical AND of this specification on the left and the supplied specification on the right. |
static Parameters |
any()
Returns a specification satified by non-null Class arrays. |
protected abstract boolean |
evaluate(java.lang.Class[] paramTypes,
int index)
Returns true if the supplied parameter array satisfies this specification. |
boolean |
isSatisfiedBy(java.lang.Class[] paramTypes)
Returns true if the supplied parameter array is not null and satisfies this specification. |
boolean |
isSatisifiedByAll(java.lang.Class[][] all)
Returns true if all of the supplied Class arrays satisfy this specification. |
boolean |
isSatisifiedByAny(java.lang.Class[][] any)
Returns true if any of the supplied Class arrays satisfy this specification. |
Parameters |
not()
Returns a specification representing a logical NOT of this specification. |
Parameters |
or(Parameters specification)
Returns a specification representing a logical OR of this specification on the left and the supplied specification on the right. |
static Parameters |
parse(java.lang.String parametersPattern)
Parses a pattern string into a complete Parameters specification. |
java.lang.Class[][] |
selectAll(java.lang.Class[][] from)
Selects all the Class arrays that satisfy this specification from the supplied array. |
java.lang.Class[] |
selectFirst(java.lang.Class[][] from)
Selects the first Class array that satisfies this specification from the supplied array. |
static Parameters.Builder |
startingWithAny()
Returns a Builder whose resulting Parameters specification will allow any number of inital elements. |
static Parameters.Builder |
startingWithElement(Types specification)
Returns a Builder whose resulting Parameters specification will require the supplied inital element. |
static Parameters.Builder |
startingWithElements(Types[] specifications)
Returns a Builder whose resulting Parameters specification will require the supplied inital elements. |
static Parameters |
withElement(Types specification)
Creates a new specification satified by Class arrays with one element that satisifies the supplied specification. |
static Parameters |
withElements(Types[] specifications)
Creates a new specification satified by Class arrays with elements that satisify the supplied specifications, in order. |
static Parameters |
withNoElements()
Returns a specification satified by empty Class arrays. |
static Parameters |
withNumElements(int numberOfElements)
Creates a new specification satified by Class arrays with the specified number of elements. |
static Parameters |
withOneElement()
Returns a specification satified by Class arrays with exactly one element. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
protected Parameters()
Method Detail |
public static Parameters any()
public static Parameters withNoElements()
public static Parameters withOneElement()
public static Parameters withNumElements(int numberOfElements)
numberOfElements
- The number of elements to test for.
public static Parameters withElement(Types specification)
specification
- The specification to match the single parameter class to.
public static Parameters withElements(Types[] specifications)
specifications
- The specifications to match the parameter classes to.
public static Parameters.Builder startingWithAny()
public static Parameters.Builder startingWithElement(Types specification)
specification
- The specification the inital element must match.
public static Parameters.Builder startingWithElements(Types[] specifications)
specifications
- The specifications the inital elements must match.
public static Parameters parse(java.lang.String parametersPattern)
parameters ::= element [ "," element ]... element ::= ".." | types-expr'..' matches zero or more parameter types, everything else will be treated as a Types expression.
parametersPattern
- The content of the pattern.
ParseException
- if the pattern is invalid.public final boolean isSatisfiedBy(java.lang.Class[] paramTypes)
paramTypes
- The parameter List to test.
protected abstract boolean evaluate(java.lang.Class[] paramTypes, int index)
paramTypes
- The parameter List to test.
public final boolean isSatisifiedByAll(java.lang.Class[][] all)
all
- The array of Class arrays to test.
public final boolean isSatisifiedByAny(java.lang.Class[][] any)
any
- The array of Class arrays to test.
public final java.lang.Class[] selectFirst(java.lang.Class[][] from)
from
- The array of Class arrays to select from.
public final java.lang.Class[][] selectAll(java.lang.Class[][] from)
from
- The array of Class arrays to select from.
public final Parameters and(Parameters specification)
specification
- The specification to AND with.
public final Parameters or(Parameters specification)
specification
- The specification to OR with.
public final Parameters not()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |