jtvisitor.java
来自「Java Pattern Oriented Framework (Jt) 是为了」· Java 代码 · 共 80 行
JAVA
80 行
package Jt;
/**
* Jt Implementation of the Visitor design pattern.
*/
public class JtVisitor extends JtObject {
public static final String JtCLASS_NAME = JtVisitor.class.getName();
private static final long serialVersionUID = 1L;
public JtVisitor() {
}
/**
* Process object messages.
* <ul>
* <li>JtVISIT - visit the object specified by msgContent. Subclasses need to
* override this method and provide a complete implementation for this message.
* </ul>
* @param event Jt Message
*/
public Object processMessage (Object event) {
String msgid = null;
JtMessage e = (JtMessage) event;
if (e == null)
return null;
msgid = (String) e.getMsgId ();
if (msgid == null)
return null;
//content = e.getMsgContent();
if (msgid.equals (JtObject.JtREMOVE)) {
return (null);
}
if (msgid.equals (JtObject.JtVISIT)) {
return (null);
}
return (super.processMessage(event));
}
/**
* Demonstrates the messages processed by JtVisitor.
*/
public static void main(String[] args) {
JtFactory main = new JtFactory ();
JtVisitor visitor;
// Create an instance of JtVisitor
visitor = (JtVisitor)
main.createObject (JtVisitor.JtCLASS_NAME,
"visitor");
main.removeObject (visitor);
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?