net.sourceforge.domian.specification
Class DateStringSpecification

java.lang.Object
  extended by net.sourceforge.domian.specification.AbstractSpecification<java.lang.String>
      extended by net.sourceforge.domian.specification.DateStringSpecification
All Implemented Interfaces:
LeafSpecification<java.lang.String>, Specification<java.lang.String>, ValueBoundSpecification<java.lang.String>

final class DateStringSpecification
extends AbstractSpecification<java.lang.String>
implements ValueBoundSpecification<java.lang.String>

Specification for approval of strings representing a date. The date must be a valid one.

This specification is value bound. The value is a date pattern which must be given in a java.text.SimpleDateFormat date format. Candidate string objects must be successfully parsed using this date pattern value to be approved by this specification.

Since:
0.1
Author:
Eirik Torske
See Also:
java.text.SimpleDateFormat

Field Summary
private  java.text.SimpleDateFormat simpleDateFormat
           
 
Fields inherited from class net.sourceforge.domian.specification.AbstractSpecification
type
 
Constructor Summary
DateStringSpecification(java.lang.String datePattern)
           
 
Method Summary
 boolean equals(java.lang.Object otherObject)
           
 java.lang.String getValue()
           
 int hashCode()
           
 java.lang.Boolean isSatisfiedBy(java.lang.String candidate)
           
private static boolean lengthOfYearStringIsNotEqualToLengthOfYearPatternString(java.util.Date date, java.text.SimpleDateFormat datePattern)
           
 
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
 
Methods inherited from interface net.sourceforge.domian.specification.Specification
and, getType, isDisjointWith, isGeneralizationOf, isSpecialCaseOf, or, where
 

Field Detail

simpleDateFormat

private final java.text.SimpleDateFormat simpleDateFormat
Constructor Detail

DateStringSpecification

DateStringSpecification(java.lang.String datePattern)
Method Detail

getValue

public java.lang.String getValue()
Specified by:
getValue in interface ValueBoundSpecification<java.lang.String>
Returns:
a string representation of the simpleDateFormat member object

isSatisfiedBy

public java.lang.Boolean isSatisfiedBy(java.lang.String candidate)
Specified by:
isSatisfiedBy in interface Specification<java.lang.String>

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

lengthOfYearStringIsNotEqualToLengthOfYearPatternString

private static boolean lengthOfYearStringIsNotEqualToLengthOfYearPatternString(java.util.Date date,
                                                                               java.text.SimpleDateFormat datePattern)


Copyright © 2006-2010. All Rights Reserved.