com.lonniepryor.blues.util
Class Constructors

java.lang.Object
  |
  +--com.lonniepryor.blues.util.Constructors

public abstract class Constructors
extends java.lang.Object

Specification interface for identifying Constructors. 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.

Version:
1.0
Author:
Lonnie Pryor

Constructor Summary
protected Constructors()
          Creates a new Constructors object.
 
Method Summary
 Constructors and(Constructors specification)
          Returns a specification representing a logical AND of this specification on the left and the supplied specification on the right.
static Constructors declaredOn(Types specification)
          Creates a new specification satisfied only by Constructors hosted on the Types that satisfy the supplied specification.
static Constructors declaredPackageProtected()
          Returns a specification satisfied by Constructors decalred as package protected.
static Constructors declaredPrivate()
          Returns a specification satisfied by Constructors decalred as private.
static Constructors declaredProtected()
          Returns a specification satisfied by Constructors decalred as protected.
static Constructors declaredPublic()
          Returns a specification satisfied by Constructors decalred as public.
static Constructors equalTo(java.lang.reflect.Constructor toTest)
          Creates a new specification satisfied by Constructors equal to the supplied Constructor.
protected abstract  boolean evaluate(java.lang.reflect.Constructor constructor)
          Returns true if the supplied Constructor satisfies this specification.
 boolean isSatisfiedBy(java.lang.reflect.Constructor constructor)
          Returns true if the supplied Constructor is not null and satisfies this specification.
 boolean isSatisfiedByAll(java.lang.reflect.Constructor[] all)
          Returns true if all of the supplied Constructors satisfy this specification.
 boolean isSatisfiedByAny(java.lang.reflect.Constructor[] any)
          Returns true if any of the supplied Constructors satisfy this specification.
 Constructors not()
          Returns a specification representing a logical NOT of this specification.
 Constructors or(Constructors specification)
          Returns a specification representing a logical OR of this specification on the left and the supplied specification on the right.
static Constructors parse(java.lang.String ctorsPattern)
          Parses a pattern string into a complete Constructors specification.
static Constructors publicFactories()
          Returns a specification satisfied by public Constructors that take no parameters.
 java.lang.reflect.Constructor[] selectAll(java.lang.reflect.Constructor[] from)
          Selects all the Constructors that satisfy this specification from the supplied array.
 java.lang.reflect.Constructor selectFirst(java.lang.reflect.Constructor[] from)
          Selects the first Constructor that satisfies this specification from the supplied array.
static Constructors taking(Parameters specification)
          Creates a new specification satisfied only by Constructors with parameter Lists that satisfy the supplied specification.
static Constructors takingNoParameters()
          Returns a specification satisfied by Constructors that take no parameters.
static Constructors takingOneParameter()
          Returns a specification satisfied by Constructors that take exactly one parameter.
static Constructors throwing(Throwables specification)
          Creates a new specification satisfied only by Constructors with throwable sets that satisfy the supplied specification.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Constructors

protected Constructors()
Creates a new Constructors object.

Method Detail

declaredPublic

public static Constructors declaredPublic()
Returns a specification satisfied by Constructors decalred as public.

Returns:
A specification satisfied by Constructors decalred as public.

declaredProtected

public static Constructors declaredProtected()
Returns a specification satisfied by Constructors decalred as protected.

Returns:
A specification satisfied by Constructors decalred as protected.

declaredPrivate

public static Constructors declaredPrivate()
Returns a specification satisfied by Constructors decalred as private.

Returns:
A specification satisfied by Constructors decalred as private.

declaredPackageProtected

public static Constructors declaredPackageProtected()
Returns a specification satisfied by Constructors decalred as package protected.

Returns:
A specification satisfied by Constructors decalred as package protected.

takingNoParameters

public static Constructors takingNoParameters()
Returns a specification satisfied by Constructors that take no parameters.

Returns:
A specification satisfied by Constructors that take no parameters.

takingOneParameter

public static Constructors takingOneParameter()
Returns a specification satisfied by Constructors that take exactly one parameter.

Returns:
A specification satisfied by Constructors that take exactly one parameter.

publicFactories

public static Constructors publicFactories()
Returns a specification satisfied by public Constructors that take no parameters.

Returns:
A specification satisfied by public Constructors that take no parameters.

equalTo

public static Constructors equalTo(java.lang.reflect.Constructor toTest)
Creates a new specification satisfied by Constructors equal to the supplied Constructor.

Parameters:
toTest - The Constructor to be equal to.
Returns:
A new specification satisfied by Constructors equal to the supplied Constructor.

declaredOn

public static Constructors declaredOn(Types specification)
Creates a new specification satisfied only by Constructors hosted on the Types that satisfy the supplied specification.

Parameters:
specification - The specification that Types must match.
Returns:
A new specification satisfied only by Constructors hosted on the Types that satisfy the supplied specification.

taking

public static Constructors taking(Parameters specification)
Creates a new specification satisfied only by Constructors with parameter Lists that satisfy the supplied specification.

Parameters:
specification - The specification that parameter Lists must match.
Returns:
A new specification satisfied only by Constructors with parameter Lists that satisfy the supplied specification.

throwing

public static Constructors throwing(Throwables specification)
Creates a new specification satisfied only by Constructors with throwable sets that satisfy the supplied specification.

Parameters:
specification - The specification that throwable sets must match.
Returns:
A new specification satisfied only by Constructors with throwable sets that satisfy the supplied specification.

parse

public static Constructors parse(java.lang.String ctorsPattern)
Parses a pattern string into a complete Constructors specification. Format:
   constructors    ::=  throws-clause
   throws-clause   ::=  param-list [ " throws " throwables ]
   param-list      ::=  declaring-type "(" [ parameters ] ")" 
   declaring-type  ::=  [ modifiers ] [ types | "(" types-expr ")" "." ] "new"
   modifiers       ::=  ( [ "!" ] 
                          ( "public" | "protected" | "package" | "private" ) )...
 
Example:
   public (com.lonniepryor..* && !javax..*+).new(..)
 
The above matches public constructors taking any number of parameters on any class in the 'com.lonniepryor' namespace that is not assignable to a class in the 'javax' namespace.

Parameters:
ctorsPattern - The pattern string.
Returns:
A specification matching the supplied constructor pattern.
See Also:
Types.parse(String), Parameters.parse(String)

isSatisfiedBy

public final boolean isSatisfiedBy(java.lang.reflect.Constructor constructor)
Returns true if the supplied Constructor is not null and satisfies this specification.

Parameters:
constructor - The Constructor to test.
Returns:
True if the supplied Constructor is not null and satisfies this specification.

evaluate

protected abstract boolean evaluate(java.lang.reflect.Constructor constructor)
Returns true if the supplied Constructor satisfies this specification.

Parameters:
constructor - The Constructor to test.
Returns:
True if the supplied Constructor satisfies this specification.

isSatisfiedByAll

public final boolean isSatisfiedByAll(java.lang.reflect.Constructor[] all)
Returns true if all of the supplied Constructors satisfy this specification.

Parameters:
all - The array of Constructors to test.
Returns:
True if all of the supplied Constructors satisfy this specification.

isSatisfiedByAny

public final boolean isSatisfiedByAny(java.lang.reflect.Constructor[] any)
Returns true if any of the supplied Constructors satisfy this specification.

Parameters:
any - The array of Constructors to test.
Returns:
True if any of the supplied Constructors satisfy this specification.

selectFirst

public final java.lang.reflect.Constructor selectFirst(java.lang.reflect.Constructor[] from)
Selects the first Constructor that satisfies this specification from the supplied array.

Parameters:
from - The array to select from.
Returns:
The first Constructor that satisfies this specification from the supplied array.

selectAll

public final java.lang.reflect.Constructor[] selectAll(java.lang.reflect.Constructor[] from)
Selects all the Constructors that satisfy this specification from the supplied array.

Parameters:
from - The array to select from.
Returns:
All the Constructors that satisfy this specification from the supplied array.

and

public final Constructors and(Constructors specification)
Returns a specification representing a logical AND of this specification on the left and the supplied specification on the right.

Parameters:
specification - The specification to AND with.
Returns:
A specification representing a logical AND of this specification on the left and the supplied specification on the right.

or

public final Constructors or(Constructors specification)
Returns a specification representing a logical OR of this specification on the left and the supplied specification on the right.

Parameters:
specification - The specification to OR with.
Returns:
A specification representing a logical OR of this specification on the left and the supplied specification on the right.

not

public final Constructors not()
Returns a specification representing a logical NOT of this specification.

Returns:
A specification representing a logical NOT of this specification.


Copyright © 2003 Blues Framework. All Rights Reserved.