viewstructfiller.java
来自「一个java 代码生成器」· Java 代码 · 共 85 行
JAVA
85 行
/**
* 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.views;
import com.jenerator.struct.Filler;
import com.jenerator.util.Configurator;
import org.apache.log4j.Logger;
/**
*
*
* @author Siddhartha P. Chandukar
* @version 0.9.0
*/
public class ViewStructFiller implements Filler {
//ATTRIBUTES
private String type;
private ViewStruct viewStruct;
private static Logger log = Logger.getLogger(ViewStructFiller.class.getName());
//CONSTRUCTORS
public ViewStructFiller() {
}
public ViewStructFiller(String type) {
this.type = type;
}
/**
* Indicates that it is the start of the node. so that the structure
* to be filled can be instantiated
* @param boolean flag Indicating that it is the starting
* of the node
*/
public void setStartOfNode(boolean flag) {
if (flag == true) {
if (type.equals("servlet"))
viewStruct = new ServletStruct();
} else {
log.debug("Inside else \n");
Configurator.getInstance().getConfigStructs().addViewStruct(viewStruct);
}
}
/**
* Sets the root element, so that the appropriate structure can
* be instantiated
* @param String rootElement The rootElement from where the parsing
* has started.
*/
public void setRootElement(String rootElement) {
this.type = rootElement;
}
/**
* Fills the structure with the node name and the node value
* @param String nodeName The name of the node
* @param String nodeValue The value of the node
* @param String parent The parent node of the node which
* represents the nodeName
*/
public void fill(String nodeName, String nodeValue, String parentName) {
if (nodeName.equals("package")) {
log.debug("PACKAGE NAME " + nodeValue);
viewStruct.setPackageName(nodeValue);
} else if (nodeName.equals("servlet-class-name") && parentName.equals("servlet")) {
log.debug("SERVLET CLASS NAME " + nodeValue);
((ServletStruct) viewStruct).setName(nodeValue);
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?