net.sourceforge.domian.specification
Interface CompositeSpecification<T>

All Superinterfaces:
Specification<T>
All Known Implementing Classes:
AbstractCompositeSpecification, ConjuntionSpecification, DisjuntionSpecification, JointDenialSpecification

public interface CompositeSpecification<T>
extends Specification<T>

Part of the Evans/Fowler Specifications pattern.

Since:
0.1
Author:
Eirik Torske
See Also:
The Specifications Pattern

Method Summary
 CompositeSpecification<T> and(Specification<T> specification)
          Creates a conjunction out of two specifications:
  • This composite specification
  • The given specification parameter
  • <F> CompositeSpecification<T>
    and(java.lang.String accessibleObjectName, Specification<F> accessibleObjectSpecification)
              Creates a conjunction of two specifications:
  • This composite specification
  • A parameterized specification based on the java.lang.reflect.AccessibleObject name parameter and the accompanying specification parameter
  •  CompositeSpecification<T> or(Specification<T> specification)
              Creates a disjunction out of two specifications:
  • This composite specification
  • The given specification parameter
  • <F> CompositeSpecification<T>
    or(java.lang.String accessibleObjectName, Specification<F> accessibleObjectSpecification)
              Creates a disjunction of two specifications:
  • This composite specification
  • A parameterized specification based on the java.lang.reflect.AccessibleObject name parameter and the accompanying specification parameter
  •  CompositeSpecification<T> remainderUnsatisfiedBy(T candidate)
              Partially satisfied specification.
    <F> CompositeSpecification<T>
    where(java.lang.String accessibleObjectName, Specification<F> accessibleObjectSpecification)
              Alias of and method.
     
    Methods inherited from interface net.sourceforge.domian.specification.Specification
    getType, isGeneralizationOf, isSatisfiedBy, isSpecialCaseOf
     

    Method Detail

    where

    <F> CompositeSpecification<T> where(java.lang.String accessibleObjectName,
                                        Specification<F> accessibleObjectSpecification)
    Alias of and method.

    Parameters:
    accessibleObjectName - the name of the accessible object to specify
    accessibleObjectSpecification - the specification coupled to the accessible object
    Returns:
    a conjunction of this specification and the accessible object specification
    Throws:
    java.lang.IllegalArgumentException - if any of the parameters are null
    java.lang.UnsupportedOperationException - if this method is called twice in the overall specification expression (fluent interface constraint)

    and

    <F> CompositeSpecification<T> and(java.lang.String accessibleObjectName,
                                      Specification<F> accessibleObjectSpecification)
    Creates a conjunction of two specifications:
    1. This composite specification
    2. A parameterized specification based on the java.lang.reflect.AccessibleObject name parameter and the accompanying specification parameter

    Parameters:
    accessibleObjectName - the name of the accessible object to specify
    accessibleObjectSpecification - the specification coupled to the accessible object
    Returns:
    a new composite specification: this specification AND the parameterized specification
    Throws:
    java.lang.IllegalArgumentException - if any of the parameters are null
    java.lang.IllegalArgumentException - if the accessible object name is illegal
    java.lang.IllegalArgumentException - if the type of the accessible object and the type of the specification are not compatible
    java.lang.UnsupportedOperationException - if this method is not placed behind a where clause in the overall specification expression (fluent interface constraint)

    or

    <F> CompositeSpecification<T> or(java.lang.String accessibleObjectName,
                                     Specification<F> accessibleObjectSpecification)
    Creates a disjunction of two specifications:
    1. This composite specification
    2. A parameterized specification based on the java.lang.reflect.AccessibleObject name parameter and the accompanying specification parameter

    Parameters:
    accessibleObjectName - the name of the accessible object to specify
    accessibleObjectSpecification - the specification coupled to the accessible object
    Returns:
    a new composite specification: this specification OR the parameterized specification
    Throws:
    java.lang.IllegalArgumentException - if any of the parameters are null
    java.lang.IllegalArgumentException - if the accessible object name is illegal
    java.lang.IllegalArgumentException - if the type of the accessible object and the type of the specification are not compatible
    java.lang.UnsupportedOperationException - if this method is not placed behind a where clause in the overall specification expression (fluent interface constraint)

    and

    CompositeSpecification<T> and(Specification<T> specification)
    Creates a conjunction out of two specifications:
    1. This composite specification
    2. The given specification parameter

    Parameters:
    specification - the specification to combine with this specification
    Returns:
    a new composite specification: this specification AND the specification parameter
    Throws:
    java.lang.IllegalArgumentException - if the parameter is null

    or

    CompositeSpecification<T> or(Specification<T> specification)
    Creates a disjunction out of two specifications:
    1. This composite specification
    2. The given specification parameter

    Parameters:
    specification - the specification to combine with this specification
    Returns:
    a new composite specification: this specification OR the specification parameter
    Throws:
    java.lang.IllegalArgumentException - if the parameter is null

    remainderUnsatisfiedBy

    CompositeSpecification<T> remainderUnsatisfiedBy(T candidate)
    Partially satisfied specification.

    Given SpecX = specA AND specB then:

    1. specX.isSpecialCaseOf(specA)
    2. specX.isSpecialCaseOf(specB)
    Given SpecX = specA OR specB then:
    1. specX.isGeneralizationOf(specA)
    2. specX.isGeneralizationOf(specB)

    Parameters:
    candidate - The candidate object
    Returns:
    A composite specification consisting of all this specification's components not satisfied by the given candidate object - or null if (in fact) this specification is satisfied by the candidate object
    Since:
    0.3


    Copyright © 2006-2009. All Rights Reserved.