|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.lonniepryor.blues.util.Fields
Specification interface for identifying Fields. 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 |
Fields()
Creates a new Fields object. |
Method Summary | |
Fields |
and(Fields specification)
Returns a specification representing a logical AND of this specification on the left and the supplied specification on the right. |
static Fields |
declaredFinal()
Returns a specification matching final fields. |
static Fields |
declaredOn(Types specification)
Creates a new specification satisfied only by Fields declared on the Types that satisfy the supplied specification. |
static Fields |
declaredPackageProtected()
Returns a specification matching package protected fields. |
static Fields |
declaredPrivate()
Returns a specification matching private fields. |
static Fields |
declaredProtected()
Returns a specification matching protected fields. |
static Fields |
declaredPublic()
Returns a specification matching public fields. |
static Fields |
declaredStatic()
Returns a specification matching static fields. |
static Fields |
declaredTransient()
Returns a specification matching transient fields. |
static Fields |
declaredVolatile()
Returns a specification matching volatile fields. |
static Fields |
equalTo(java.lang.reflect.Field toTest)
Creates a new specification satisfied by Fields equal to the supplied Field. |
abstract boolean |
evaluate(java.lang.reflect.Field field)
Returns true if the supplied Field satisfies this specification. |
boolean |
isSatisfiedBy(java.lang.reflect.Field field)
Returns true if the supplied Field is not null and satisfies this specification. |
boolean |
isSatisifiedByAll(java.lang.reflect.Field[] all)
Returns true if all of the supplied Fields satisfy this specification. |
boolean |
isSatisifiedByAny(java.lang.reflect.Field[] any)
Returns true if any of the supplied Fields satisfy this specification. |
static Fields |
named(java.lang.String namePattern)
Creates a new specification satisfied by Fields whose names match the supplied pattern. |
static Fields |
named(Strings specification)
Creates a new specification satisfied by Fields whose names match the supplied specification. |
Fields |
not()
Returns a specification representing a logical NOT of this specification. |
static Fields |
ofType(Types specification)
Creates a new specification satisfied by Fields whose type satisfy the supplied specification. |
Fields |
or(Fields specification)
Returns a specification representing a logical OR of this specification on the left and the supplied specification on the right. |
static Fields |
parse(java.lang.String fieldsPattern)
Parses a pattern string into a complete Fields specification. |
java.lang.reflect.Field[] |
selectAll(java.lang.reflect.Field[] from)
Selects all the Fields that satisfy this specification from the supplied array. |
java.lang.reflect.Field |
selectFirst(java.lang.reflect.Field[] from)
Selects the first Field that satisfies this specification from the supplied array. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
protected Fields()
Method Detail |
public static Fields declaredPublic()
public static Fields declaredProtected()
public static Fields declaredPrivate()
public static Fields declaredPackageProtected()
public static Fields declaredFinal()
public static Fields declaredStatic()
public static Fields declaredTransient()
public static Fields declaredVolatile()
public static Fields equalTo(java.lang.reflect.Field toTest)
toTest
- The Field to be equal to.
public static Fields declaredOn(Types specification)
specification
- The specification that Types must match.
public static Fields named(java.lang.String namePattern)
namePattern
- The pattern names must match.
ParseException
- if the name pattern is invalid.public static Fields named(Strings specification)
specification
- The specification names must match.
public static Fields ofType(Types specification)
specification
- The specification types must match.
public static Fields parse(java.lang.String fieldsPattern)
fields ::= name name ::= [ field-type ] [ types | "(" types-expr ")" "." ] ( strings | "(" strings-expr ")" ) field-type ::= [ modifiers ] ( types | "(" types-expr ")" ) modifiers ::= ( [ "!" ] ( "public" | "protected" | "package" | "private" | "static" | "abstract" | "final" ) )...Example:
(int | float) com.lonniepryor..*.fooThe above matches any int or float field named 'foo', declared on any class in the 'com.lonniepryor' namespace.
fieldsPattern
- The pattern definition string.
ParseException
- if the pattern is invalid.public final boolean isSatisfiedBy(java.lang.reflect.Field field)
field
- The Field to test.
public abstract boolean evaluate(java.lang.reflect.Field field)
public final boolean isSatisifiedByAll(java.lang.reflect.Field[] all)
all
- The array of Fields to test.
public final boolean isSatisifiedByAny(java.lang.reflect.Field[] any)
any
- The array of Fields to test.
public final java.lang.reflect.Field selectFirst(java.lang.reflect.Field[] from)
from
- The array to select from.
public final java.lang.reflect.Field[] selectAll(java.lang.reflect.Field[] from)
from
- The array to select from.
public final Fields and(Fields specification)
specification
- The specification to AND with.
public final Fields or(Fields specification)
specification
- The specification to OR with.
public final Fields not()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |