converter.java

来自「一个java 代码生成器」· Java 代码 · 共 77 行

JAVA
77
字号
/**
 * Copyright (c) 2002, Siddhartha P. Chandurkar siddhartha@visioncodified.com
 * All rights reserved.
 * Licensed under the Academic Free License version 1.1
 * See the file LICENSE.TXT for details.
 * LICENSE.txt is located in the directory  <install-directory>\Jenerator
 * of your Jenertaor Installation.
 *
 **/
package com.jenerator.converter;


import com.jenerator.dbaccess.DatabaseInfo;
import com.jenerator.util.ConfigurationException;
import org.apache.log4j.Logger;

import java.sql.SQLException;
import java.util.Properties;

//</Imports>

/**
 * Convertor
 * This is an abstract class which has to be derived by any class which wants to
 * convert the DataBase MetaData into some form
 *
 * @see  ObjectConverter
 *
 * @author Siddhartha P. Chandurkar
 * @version 0.9.0
 */
public abstract class Converter {

    //ATTRIBUTES
    //The object which is used to access the DatabaseMetaData information
    protected DatabaseInfo dbInfo;
    //Contains the properties of the JDBC2JAVA properties
    protected Properties props;
    //Logger
    private static Logger log = Logger.getLogger(com.jenerator.converter.Converter.class.getName());

    //CONSTRUCTORS
    /**
     * Converter
     * Instantiates the DatabaseInfo object and reads the properties from
     * the file JDBC2JAVA.properties
     */
    public Converter() throws ConfigurationException, ConversionException {
        try {
            dbInfo = new DatabaseInfo();
            props = new Properties();
            // props.load(new FileInputStream(Configurator.getInstance().getJenHome() + File.separator + "config" + File.separator + "JDBC2JAVA.properties"));

            /*} catch (FileNotFoundException e) {
                log.fatal(e);
                throw new ConfigurationException(e);
            } catch (IOException e) {
                log.fatal(e);
                throw new ConfigurationException(e);
            **/
        } catch (SQLException e) {
            log.fatal(e);
            throw new ConversionException(e);
        }
    }//Converter


    //METHODS
    /**
     * convert
     * This operation has to be overidden by all the subclasses of this class. The conversion logic
     * has to be written in this method
     *
     */
    public abstract Object convert() throws ConversionException;

}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?