package com.quantum.model;


/**
 * 
 * 
 * @author BC
 */
public class EntityFactory {
    
    private static EntityFactory instance = new EntityFactory();
    
    private EntityFactory() {
    }
    
    public static EntityFactory getInstance() {
        return EntityFactory.instance;
    }
    
    public Entity create(Bookmark bookmark, String schema, String name, String type, boolean isSynonym) {
        if (type != null) {
            type = type.toUpperCase().trim();
        }
        
        if (Entity.TABLE_TYPE.equals(type)) {
            return new TableImpl(bookmark, schema, name, isSynonym);
        } else if (Entity.VIEW_TYPE.equals(type)) {
            return new ViewImpl(bookmark, schema, name, isSynonym);
        } else if (Entity.SEQUENCE_TYPE.equals(type)) {
            return new SequenceImpl(bookmark, schema, name, isSynonym);
        } else {
            return null;
//            throw new IllegalArgumentException("Unknown type: " + type);
        }
    }
}