appconfigstructfiller.java
来自「一个java 代码生成器」· Java 代码 · 共 84 行
JAVA
84 行
/**
* 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.struct.app;
//<Imports>
import com.jenerator.struct.Filler;
import com.jenerator.util.Configurator;
import org.apache.log4j.Logger;
//</Imports>
/**
* AppConfigStructFiller
*
* @author Siddhartha P. Chandurkar
* @version 0.9.0
*/
public class AppConfigStructFiller implements Filler {
//ATTRIBUTES
//A structure containg all the configurations for the Application
private AppConfigStruct configStruct;
//logger
private static Logger log = Logger.getLogger(AppConfigStructFiller.class.getName());
//METHODS
/**
* fill
* This operation is invoked by the GenericXmlParser. Whenever it encounters any Node
*
* @param nodeName A String containing the current Node Name
* @param nodeValue A String containing the current Node Value
* @param parent A String containing the parent Node Name
* @see GenericXmlParser
*/
public void fill(String nodeName, String nodeValue, String parent) {
if (nodeName.equals("driver"))
configStruct.setJdbcDriver(nodeValue);
else if (nodeName.equals("url"))
configStruct.setUrl(nodeValue);
else if (nodeName.equals("user-name"))
configStruct.setUserName(nodeValue);
else if (nodeName.equals("password"))
configStruct.setPassword(nodeValue);
else if (nodeName.equals("gen-output-dir"))
configStruct.setGenDir(nodeValue);
}//fill
/**
* setStartOfNode
* Tells whether it is the start of the node or not.
* This method is called by the GenericXmlPaser
* @param flag A boolean telling whether it is the start of the node or not
* @see GenericXmlParser
*/
public void setStartOfNode(boolean flag) {
if (flag == true)
configStruct = new AppConfigStruct();
else
Configurator.getInstance().getConfigStructs().addAppConfigStruct(configStruct);
}//setStartOfNode
/**
* setRootElement
* Tells the root element from which the parsing has started.
* Here the meaning of root element is the element from where the parsing has been
* started by the GenericXmlParser it can be any element in the heirarchy of XML element
* This method is called by the GenericXmlPaser
*
* @param _rootElement A String which contains the name of the root element.
* @see GenericXmlParser
*/
public void setRootElement(String _rootElement) {
}//setRootElement
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?