01: //$Id: VersionType.java 7736 2005-08-03 20:03:34Z steveebersole $
02: package org.hibernate.type;
03:
04: import java.util.Comparator;
05:
06: import org.hibernate.engine.SessionImplementor;
07:
08: /**
09: * A <tt>Type</tt> that may be used to version data.
10: * @author Gavin King
11: */
12: public interface VersionType extends Type {
13: /**
14: * Generate an initial version.
15: *
16: * @param session The session from which this request originates.
17: * @return an instance of the type
18: */
19: public Object seed(SessionImplementor session);
20:
21: /**
22: * Increment the version.
23: *
24: * @param session The session from which this request originates.
25: * @param current the current version
26: * @return an instance of the type
27: */
28: public Object next(Object current, SessionImplementor session);
29:
30: /**
31: * Get a comparator for version values.
32: *
33: * @return The comparator to use to compare different version values.
34: */
35: public Comparator getComparator();
36:
37: /**
38: * Are the two version values considered equal?
39: *
40: * @param x One value to check.
41: * @param y The other value to check.
42: * @return true if the values are equal, false otherwise.
43: */
44: public boolean isEqual(Object x, Object y);
45: }
|