⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 transformstrategy.java

📁 一个java 代码生成器
💻 JAVA
字号:
/**
 * 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.transformer;

//<Imports>
//Java imports

import com.jenerator.regen.*;
import com.jenerator.util.Configurator;
import org.apache.log4j.Logger;

import java.io.File;

//</Imports>

/**
 * TransformStrategy
 * This is a super class which is based on the <i>Strategy Pattern</i>
 * This class is extended by all the concrete Strategies
 * @author  Siddhartha P. Chandurkar
 * @version 0.9.0
 */
public abstract class TransformStrategy {

    //ATTRIBUTES
    //The interface which a concrete Processor which Process XML and XSL implements
    protected Processable processor;
    private static Logger log = Logger.getLogger(com.jenerator.transformer.TransformStrategy.class.getName());
    protected String genDir = Configurator.getInstance().getConfigStructs().getAppConfigStruct().getGenDir();
    protected Extract extract = null;


    //CONSTRUCTORS
    /**
     * Contructor which instantiates the XmlAndXslProcessor
     * @see XmlAndXslProcessor      The class which takes an XML stream and applies
     *                              a XSL template to generate code or descriptor file
     */
    public TransformStrategy() {
        processor = new XmlAndXslProcessor();


    }//TransformStrategy

    //METHODS
    /**
     * This is an abstract method which each class which extends from this
     * class has to override. This method cordinates the transformation
     * of XML to code using appropriate templates
     * @exception   TransformFailedExceptoin    The transformation from XML to code
     *                                          code has failed
     */
    public abstract void transform() throws TransformFailedException;


    protected Extract extractManualCode(File file) throws ExtracterException {

        CodeExtracter extracter = new CodeExtracter(file);
        return extracter.extract();

    }

    protected void replaceManualCode(File file, Extract extract) throws ReplacerException {
        CodeReplacer replacer = new CodeReplacer(file);
        replacer.replace(extract);
    }


}

⌨️ 快捷键说明

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