View Javadoc

1   package org.sourceforge.jemm.database.persistent.berkeley;
2   
3   import com.sleepycat.persist.model.Entity;
4   import com.sleepycat.persist.model.PrimaryKey;
5   
6   @Entity
7   public class IDEntry {
8   	
9   	@PrimaryKey
10  	protected final String typeName;
11  	
12  	long nextIdValue = 1;
13  	
14  	public IDEntry(String typeName) {
15  		this.typeName = typeName;		
16  	}
17  	
18  	@SuppressWarnings("unused")
19  	private IDEntry() { typeName = null; }
20  
21  	public synchronized long getAndIncrement() {
22  		return nextIdValue++;
23  	}
24  	
25  	
26  	
27  }