net.sourceforge.domian.specification
Class DefaultValueSpecification<T>
java.lang.Object
net.sourceforge.domian.specification.AbstractSpecification<T>
net.sourceforge.domian.specification.DefaultValueSpecification<T>
- All Implemented Interfaces:
- LeafSpecification<T>, Specification<T>
final class DefaultValueSpecification<T>
- extends AbstractSpecification<T>
- implements LeafSpecification<T>
Leaf specification, specifying all Java objects with their default value intact.
In addition to that, all blank strings are approved as well.
This specification is the only specification which actually approves null
-valued candidates.
Specification spec = new DefaultValueSpecification();
spec.isSatisfiedBy(null) -> true
spec.isSatisfiedBy(false) -> true
spec.isSatisfiedBy(true) -> false
spec.isSatisfiedBy("") -> true
spec.isSatisfiedBy(" ") -> true
spec.isSatisfiedBy("\n") -> true
spec.isSatisfiedBy("\r") -> true
spec.isSatisfiedBy("\t") -> true
spec.isSatisfiedBy("\r\n") -> true
spec.isSatisfiedBy(".") -> false
spec.isSatisfiedBy(0) -> true
spec.isSatisfiedBy(0L) -> true
spec.isSatisfiedBy(0.0F) -> true
spec.isSatisfiedBy(0.0D) -> true
spec.isSatisfiedBy((short) 0) -> true
spec.isSatisfiedBy(new Integer(0)) -> true
spec.isSatisfiedBy(new Long(0)) -> true
spec.isSatisfiedBy(new Float(0.00)) -> true
spec.isSatisfiedBy(new Double(0.0000)) -> true
spec.isSatisfiedBy(1) -> false
- Since:
- 0.1
- Author:
- Eirik Torske
Methods inherited from class net.sourceforge.domian.specification.AbstractSpecification |
and, containsSimpleCompositesOnly, containsValueBoundSpecificationsOnly, createValueBoundSpecification, getAllSpecifications, getNegatedSpecification, getNumberOfLevelsOfNegations, getType, hasConjunction, hasDisjunction, intersectsWith, invert, isDisjointWith, isGeneralizationOf, isIntersectionOf, isInvertible, isOddNumber, isSpecialCaseOf, or, purify, toString, where |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
DefaultValueSpecification
DefaultValueSpecification()
DefaultValueSpecification
DefaultValueSpecification(java.lang.Class<T> type)
isSatisfiedBy
public java.lang.Boolean isSatisfiedBy(T candidate)
- Specified by:
isSatisfiedBy
in interface Specification<T>
hashCode
public int hashCode()
- Overrides:
hashCode
in class java.lang.Object
equals
public boolean equals(java.lang.Object otherObject)
- Overrides:
equals
in class java.lang.Object
Copyright © 2006-2010. All Rights Reserved.