KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > avalon > excalibur > source > validity > TimeStampValidity


1 /*
2  * Copyright (C) The Apache Software Foundation. All rights reserved.
3  *
4  * This software is published under the terms of the Apache Software License
5  * version 1.1, a copy of which has been included with this distribution in
6  * the LICENSE.txt file.
7  */

8 package org.apache.avalon.excalibur.source.validity;
9
10 import org.apache.avalon.excalibur.source.SourceValidity;
11
12 /**
13  * A validation object for time-stamps.
14  *
15  * @author <a HREF="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
16  * @version CVS $Revision: 1.2 $ $Date: 2001/12/17 13:20:57 $
17  */

18 public final class TimeStampValidity
19 implements SourceValidity {
20
21     private long timeStamp;
22
23     public TimeStampValidity(long timeStamp) {
24         this.timeStamp = timeStamp;
25     }
26
27     /**
28      * Check if the component is still valid.
29      * If <code>false</code> is returned the isValid(SourceValidity) must be
30      * called afterwards!
31      */

32     public boolean isValid() {
33         return false;
34     }
35
36     public boolean isValid(SourceValidity newValidity) {
37         if (newValidity instanceof TimeStampValidity) {
38             return this.timeStamp == ((TimeStampValidity)newValidity).getTimeStamp();
39         }
40         return false;
41     }
42
43     public long getTimeStamp() {
44         return this.timeStamp;
45     }
46
47     public String JavaDoc toString() {
48         return "TimeStampValidity: " + this.timeStamp;
49     }
50
51 }
52
Popular Tags