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

📄 messagedto.java

📁 该源码是使用ajax技术实现的一个聊天室功能。如果想对程序进行修改
💻 JAVA
字号:
/*
 * 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.dto;


import java.lang.reflect.Field;
import java.util.Date;


/**
 * This class is a Data Transfer Object (DTO) that describes a Message.
 *
 * @author <a href="mailto:fzammetti@omnytex.com">Frank W. Zammetti</a>.
 */
public class MessageDTO {


  /**
   * Text of the message.
   */
  private String text;


  /**
   * User who posted the message.
   */
  private UserDTO postedBy;


  /**
   * Date and time the message was posted.
   */
  private Date postedDateTime;


  /**
   * Accessor for text field.
   *
   * @return String Current value of text Field.
   */
  public String getText() {

    return text;

  } // End getText().


  /**
   * Mutator for text field.
   *
   * @param inText New value of text field.
   */
  public void setText(String inText) {

    text = inText;

  } // End setText().


  /**
   * Accessor for postedBy field.
   *
   * @return String Current value of postedBy Field.
   */
  public UserDTO getPostedBy() {

    return postedBy;

  } // End getPostedBy().


  /**
   * Mutator for postedBy field.
   *
   * @param inPostedBy New value of postedBy field.
   */
  public void setPostedBy(UserDTO inPostedBy) {

    postedBy = inPostedBy;

  } // End setPostedBy().


  /**
   * Accessor for postedDateTime field.
   *
   * @return String Current value of postedDateTime Field.
   */
  public Date getPostedDateTime() {

    return postedDateTime;

  } // End getPostedDateTime().


  /**
   * Mutator for postedDateTime field.
   *
   * @param inPostedDateTime New value of postedDateTime field.
   */
  public void setPostedDateTime(Date inPostedDateTime) {

    postedDateTime = inPostedDateTime;

  } // End setPostedDateTime().


  /**
   * 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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -