1) Fixed issue #776.
[phpeclipse.git] / archive / net.sourceforge.phpeclipse.quantum.sql / src / com / quantum / model / EntityFactory.java
1 package com.quantum.model;
2
3
4 /**
5  * 
6  * 
7  * @author BC
8  */
9 public class EntityFactory {
10     
11     private static EntityFactory instance = new EntityFactory();
12     
13     private EntityFactory() {
14     }
15     
16     public static EntityFactory getInstance() {
17         return EntityFactory.instance;
18     }
19     
20     public Entity create(Bookmark bookmark, String schema, String name, String type, boolean isSynonym) {
21         if (type != null) {
22             type = type.toUpperCase().trim();
23         }
24         
25         if (Entity.TABLE_TYPE.equals(type)) {
26             return new TableImpl(bookmark, schema, name, isSynonym);
27         } else if (Entity.VIEW_TYPE.equals(type)) {
28             return new ViewImpl(bookmark, schema, name, isSynonym);
29         } else if (Entity.SEQUENCE_TYPE.equals(type)) {
30             return new SequenceImpl(bookmark, schema, name, isSynonym);
31         } else {
32             return null;
33 //            throw new IllegalArgumentException("Unknown type: " + type);
34         }
35     }
36 }