IdGeneratorFactory.java
资源名称:某公司的java培训教材 [点击查看]
上传用户:dinglihq
上传日期:2013-02-04
资源大小:99958k
文件大小:1k
源码类别:
Java编程
开发平台:
Java
- package com.borland.training.meetings.entities;
- // This is a factory class that encapsulates creating a concrete primary key
- // generation algorithm, making future changes of this algorithm easy.
- public class IdGeneratorFactory {
- private static IdGeneratorFactory instance = null;
- private IdGenerator generator;
- private IdGeneratorFactory() {
- generator = SimpleIdGenerator.getInstance();
- }
- public static IdGeneratorFactory getInstance() {
- if(instance == null) {
- instance = new IdGeneratorFactory();
- }
- return instance;
- }
- public IdGenerator getGenerator() {
- return generator;
- }
- }