|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.lonniepryor.blues.util.Types
Specification interface for identifying types and classes. Instances of this class may be logically combined using the AND, OR, and NOT operations. Many common use-cases are supplied via static accessor methods.
Constructor Summary | |
protected |
Types()
Creates a new Types object. |
Method Summary | |
Types |
and(Types specification)
Returns a specification representing a logical AND of this specification on the left and the supplied specification on the right. |
static Types |
arrays()
Returns a specification matching array types. |
static Types |
arraysOf(Types specification)
Creates a new specification satisfied by array types whose component type matches the supplied specification. |
static Types |
assignableFrom(java.lang.Class toTest)
Creates a new specification satisfied by Types that are assignable from the supplied Class. |
static Types |
assignableTo(java.lang.Class toTest)
Creates a new specification satisfied by Types that are assignable to the supplied Class. |
static Types |
classes()
Returns a specification matching class types. |
static Types |
declaredAbstract()
Returns a specification matching abstract types. |
static Types |
declaredConcrete()
Returns a specification matching concrete types. |
static Types |
declaredFinal()
Returns a specification matching final types. |
static Types |
declaredOn(Types specification)
Creates a new specification satisfied only by Types declared on the Types that satisfy the supplied specification. |
static Types |
declaredPackageProtected()
Returns a specification matching package protected types. |
static Types |
declaredPrivate()
Returns a specification matching private types. |
static Types |
declaredProtected()
Returns a specification matching protected types. |
static Types |
declaredPublic()
Returns a specification matching public types. |
static Types |
declaredStatic()
Returns a specification matching static types. |
static Types |
equalTo(java.lang.Class toTest)
Creates a new specification satisfied by Types equal to the supplied Class. |
abstract boolean |
evaluate(java.lang.Class cls)
Returns true if the supplied Class satisfies this specification. |
static Types |
inheritingFrom(Types specification)
Creates a new specification satisfied by Types that inherit from any Class that is satisfied by the supplied specification. |
static Types |
interfaces()
Returns a specification matching interface types. |
boolean |
isSatisfiedBy(java.lang.Class cls)
Returns true if the supplied Class is not null and satisfies this specification. |
boolean |
isSatisifiedByAll(java.lang.Class[] all)
Returns true if all of the supplied Types satisfy this specification. |
boolean |
isSatisifiedByAny(java.lang.Class[] any)
Returns true if any of the supplied Types satisfy this specification. |
static Types |
javaBeans()
Returns a specification matching public classes that are valid JavaBeans. |
static Types |
named(java.lang.String namePattern)
Parses a pattern consisting of a dot-delimeted type name pattern. |
static Types |
named(Strings specification)
Creates a new specification satisfied by Types whose names match the supplied pattern. |
Types |
not()
Returns a specification representing a logical NOT of this specification. |
Types |
or(Types specification)
Returns a specification representing a logical OR of this specification on the left and the supplied specification on the right. |
static Types |
parse(java.lang.String classPattern)
Parses a pattern consisting of a dot-delimeted class name optionally followed by a '+' to match all subclasses, then a '[]' to match arrays. |
static Types |
parseExpression(java.lang.String classPatternExpr)
Parses a logical expression as described in the Expression class, using this class's parse() method for creating values. |
static Types |
primitives()
Returns a specification matching primitive types. |
java.lang.Class[] |
selectAll(java.lang.Class[] from)
Selects all the Types that satisfy this specification from the supplied array. |
java.lang.Class |
selectFirst(java.lang.Class[] from)
Selects the first Class that satisfies this specification from the supplied array. |
static Types |
voids()
Returns a specification matching the void type. |
static Types |
withAConstructor(Constructors specification)
Creates a new specification satisfied by Types that have at least one constructor matching the supplied specification. |
static Types |
withADeclaredConstructor(Constructors specification)
Creates a new specification satisfied by Types that have at least one declared constructor matching the supplied specification. |
static Types |
withADeclaredField(Fields specification)
Creates a new specification satisfied by Types that have at least one declared field matching the supplied specification. |
static Types |
withADeclaredMethod(Methods specification)
Creates a new specification satisfied by Types that have at least one declared method matching the supplied specification. |
static Types |
withAField(Fields specification)
Creates a new specification satisfied by Types that have at least one field matching the supplied specification. |
static Types |
withAllConstructors(Constructors specification)
Creates a new specification satisfied by Types that have all constructors matching the supplied specification. |
static Types |
withAllDeclaredConstructors(Constructors specification)
Creates a new specification satisfied by Types that have all declared constructors matching the supplied specification. |
static Types |
withAllDeclaredConstructors(Fields specification)
Creates a new specification satisfied by Types that have all declared fields matching the supplied specification. |
static Types |
withAllDeclaredMethods(Methods specification)
Creates a new specification satisfied by Types that have all declared methods matching the supplied specification. |
static Types |
withAllFields(Fields specification)
Creates a new specification satisfied by Types that have all fields matching the supplied specification. |
static Types |
withAllMethods(Methods specification)
Creates a new specification satisfied by Types that have all methods matching the supplied specification. |
static Types |
withAMethod(Methods specification)
Creates a new specification satisfied by Types that have at least one method matching the supplied specification. |
static Types |
withAPublicNoArgCtor()
Returns a specification matching classes with a public , no-arguments constructor. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
protected Types()
Method Detail |
public static Types voids()
public static Types primitives()
public static Types arrays()
public static Types interfaces()
public static Types classes()
public static Types declaredPublic()
public static Types declaredProtected()
public static Types declaredPrivate()
public static Types declaredPackageProtected()
public static Types declaredAbstract()
public static Types declaredConcrete()
public static Types declaredFinal()
public static Types declaredStatic()
public static Types withAPublicNoArgCtor()
public static Types javaBeans()
public static Types equalTo(java.lang.Class toTest)
toTest
- The Class to be equal to.
public static Types declaredOn(Types specification)
specification
- The specification that Types must match.
public static Types named(java.lang.String namePattern)
com.lonniepryor..The above matches any class in the 'com.lonniepryor' namespace.
namePattern
- The pattern names must match.
ParseException
- if the name pattern is invalid.public static Types named(Strings specification)
specification
- The specification names must match.
public static Types arraysOf(Types specification)
specification
- The specification component types must match.
public static Types assignableFrom(java.lang.Class toTest)
toTest
- The Class to be assignable from.
public static Types assignableTo(java.lang.Class toTest)
toTest
- The Class to be assignable to.
public static Types inheritingFrom(Types specification)
specification
- The specification to inherit from.
public static Types withAField(Fields specification)
specification
- The specification to match fields to.
public static Types withADeclaredField(Fields specification)
specification
- The specification to match fields to.
public static Types withAllFields(Fields specification)
specification
- The specification to match fields to.
public static Types withAllDeclaredConstructors(Fields specification)
specification
- The specification to match fields to.
public static Types withAConstructor(Constructors specification)
specification
- The specification to match constructors to.
public static Types withADeclaredConstructor(Constructors specification)
specification
- The specification to match constructors to.
public static Types withAllConstructors(Constructors specification)
specification
- The specification to match constructors to.
public static Types withAllDeclaredConstructors(Constructors specification)
specification
- The specification to match constructors to.
public static Types withAMethod(Methods specification)
specification
- The specification to match methods to.
public static Types withADeclaredMethod(Methods specification)
specification
- The specification to match methods to.
public static Types withAllMethods(Methods specification)
specification
- The specification to match methods to.
public static Types withAllDeclaredMethods(Methods specification)
specification
- The specification to match methods to.
public static Types parse(java.lang.String classPattern)
types ::= name-pattern [ "+" ] [ "[]" ] name-pattern ::= A '.'-delimeted TokenizedStrings pattern.Example:
com.lonniepryor..*+[]The above matches arrays of any class inheriting from any class in the 'com.lonniepryor' namespace.
classPattern
- The pattern definition string.
ParseException
- if the pattern is invalid.TokenizedStrings.parse(String, char)
public static Types parseExpression(java.lang.String classPatternExpr)
classPatternExpr
- The pattern expression definition string.
ParseException
- if the pattern expression is invalid.Expression
,
parse(String)
public final boolean isSatisfiedBy(java.lang.Class cls)
cls
- The Class to test.
public abstract boolean evaluate(java.lang.Class cls)
public final boolean isSatisifiedByAll(java.lang.Class[] all)
all
- The array of Types to test.
public final boolean isSatisifiedByAny(java.lang.Class[] any)
any
- The array of Types to test.
public final java.lang.Class selectFirst(java.lang.Class[] from)
from
- The array to select from.
public final java.lang.Class[] selectAll(java.lang.Class[] from)
from
- The array to select from.
public final Types and(Types specification)
specification
- The specification to AND with.
public final Types or(Types specification)
specification
- The specification to OR with.
public final Types not()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |