net.sourceforge.domian.specification
Class AbstractSpecification<T>
java.lang.Object
net.sourceforge.domian.specification.AbstractSpecification<T>
- All Implemented Interfaces:
- Specification<T>
- Direct Known Subclasses:
- AbstractCompositeSpecification, AbstractValueBoundSpecification, AlwaysFalseSpecification, AlwaysTrueSpecification, CollectionSpecification, DateStringSpecification, DefaultValueSpecification, EnumNameStringSpecification, NotNullSpecification, ParameterizedSpecification, RegularExpressionMatcherStringSpecification
abstract class AbstractSpecification<T>
- extends java.lang.Object
- implements Specification<T>
All classes (belonging to this package) implementing Specification
or one of its sub-interfaces, should extend this class.
- Since:
- 0.3
- Author:
- Eirik Torske
Field Summary |
protected java.lang.Class<T> |
type
The type of the class this Specification is actually specifying. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
type
protected volatile java.lang.Class<T> type
- The type of the class this
Specification
is actually specifying.
AbstractSpecification
AbstractSpecification()
createType
private java.lang.Class<T> createType()
getType
public java.lang.Class<T> getType()
- Specified by:
getType
in interface Specification<T>
isGeneralizationOf
public java.lang.Boolean isGeneralizationOf(Specification<? extends T> specification)
- Specified by:
isGeneralizationOf
in interface Specification<T>
isSpecialCaseOf
public java.lang.Boolean isSpecialCaseOf(Specification<? super T> specification)
- Specified by:
isSpecialCaseOf
in interface Specification<T>
isDisjointWith
public java.lang.Boolean isDisjointWith(Specification<?> specification)
- Specified by:
isDisjointWith
in interface Specification<T>
isIntersectionOf
public java.lang.Boolean isIntersectionOf(Specification specification)
intersectsWith
public java.lang.Boolean intersectsWith(Specification specification)
where
public <F> CompositeSpecification<T> where(java.lang.String accessibleObjectName,
Specification<F> accessibleObjectSpecification)
- Specified by:
where
in interface Specification<T>
and
public CompositeSpecification<T> and(Specification<? super T> otherSpecification)
- Specified by:
and
in interface Specification<T>
or
public CompositeSpecification<T> or(Specification<? super T> otherSpecification)
- Specified by:
or
in interface Specification<T>
hasConjunction
protected java.lang.Boolean hasConjunction()
- Returns:
true
if at least one of this specification's composites is a conjunction
hasDisjunction
protected java.lang.Boolean hasDisjunction()
- Returns:
true
if at least one of this specification's composites is a disjunction
getAllSpecifications
protected void getAllSpecifications(java.util.Set<Specification<?>> specificationSet)
- Populates the given set of specifications with all
Specification
objects in this object graph.
In other words, the Set
is a flattened, unordered version of the Specification
object graph.
- Parameters:
specificationSet
- Set of specifications
- Throws:
java.lang.IllegalArgumentException
- if parameter is null
purify
protected AbstractSpecification<T> purify(boolean doPurifyInversions)
- Purify this specification.
This may imply both simplification of the specification object graph,
as well as applying boolean algebra on the overall logical expression.
- Parameters:
doPurifyInversions
- if false
leave inversions alone (they must be purified only when spec creation is completed)
- Returns:
- a purified specification
isInvertible
protected java.lang.Boolean isInvertible()
invert
protected Specification<T> invert()
containsValueBoundSpecificationsOnly
protected static <T> java.lang.Boolean containsValueBoundSpecificationsOnly(AbstractCompositeSpecification<T> compositeSpecification)
containsSimpleCompositesOnly
protected <T> java.lang.Boolean containsSimpleCompositesOnly(AbstractCompositeSpecification<T> compositeSpecification)
createValueBoundSpecification
protected static Specification createValueBoundSpecification(RelationalOperator relationalOperator,
java.lang.Object operandValue)
getNumberOfLevelsOfNegations
protected static int getNumberOfLevelsOfNegations(JointDenialSpecification jointDenialSpecification,
int levelIndex)
getNegatedSpecification
protected static <V> Specification<V> getNegatedSpecification(JointDenialSpecification<V> jointDenialSpecification)
isOddNumber
protected static boolean isOddNumber(int number)
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object
Copyright © 2006-2010. All Rights Reserved.