lobbyactionform.java
来自「该源码是使用ajax技术实现的一个聊天室功能。如果想对程序进行修改」· Java 代码 · 共 126 行
JAVA
126 行
/*
* Copyright 2005 Frank W. Zammetti
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.struts.apps.ajaxchat.actionform;
import java.lang.reflect.Field;
import java.util.Vector;
import org.apache.struts.action.ActionForm;
/**
* ActionForm for the lobby screen.
*
* @author <a href="mailto:frank.zammetti@pfpc.com">Frank W. Zammetti</a>.
*/
public class LobbyActionForm extends ActionForm {
/**
* The name of the room user clicks on.
*/
private String name = "";
/**
* List of available rooms.
*/
private Vector rooms = new Vector();
/**
* Accessor for name field.
*
* @return String Current value of name Field.
*/
public String getName() {
return name;
} // End getName().
/**
* Mutator for name field.
*
* @param inName New value of name field.
*/
public void setName(String inName) {
name = inName;
} // End setName().
/**
* Accessor for rooms field.
*
* @return Vector List of room.
*/
public Vector getRooms() {
return rooms;
} // End getRooms().
/**
* Mutator for rooms field.
*
* @param inRooms New value of rooms field.
*/
public void setRooms(Vector inRooms) {
rooms = inRooms;
} // End setRooms().
/**
* Overriden toString method.
*
* @return A reflexively-built string representation of this bean.
*/
public String toString() {
String str = null;
StringBuffer sb = new StringBuffer(1000);
sb.append("[" + super.toString() + "]={");
boolean firstPropertyDisplayed = false;
try {
Field[] fields = this.getClass().getDeclaredFields();
for (int i = 0; i < fields.length; i++) {
if (firstPropertyDisplayed) {
sb.append(", ");
} else {
firstPropertyDisplayed = true;
}
sb.append(fields[i].getName() + "=" + fields[i].get(this));
}
sb.append("}");
str = sb.toString().trim();
} catch (IllegalAccessException iae) {
iae.printStackTrace();
}
return str;
} // End toString().
} // End class.
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?