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

📄 book.java

📁 beginJsp2.0外文书籍源代码
💻 JAVA
字号:
package com.wrox.publish.om;import java.util.SortedSet;import java.util.TreeSet;import org.apache.struts.validator.ValidatorForm;/** * JavaBean encapsulating a single book. This class extends ValidatorForm * for easy population and validation within the Struts framework. */public class Book extends ValidatorForm {    /** Status for books which are in the planning stage */    public static final char PLANNED = 'P';    /** Status for books which are currently in progress */    public static final char IN_PROGRESS = 'I';    /** Status for books which have been completed and are in production */    public static final char COMPLETED = 'C';        private long id;    private String title;    private String authors;    private String editor;    private String chapters;    private int pageCount;    private double price;    private final SortedSet news = new TreeSet();    private char status = PLANNED;        /**     * Getter for property id (the primary key).     * @return Value of property id.     */    public long getId() {        return this.id;    }        /**     * Setter for property id (the primary key).     * @param id New value of property id.     */    public void setId(long id) {        this.id = id;    }        /**     * Getter for the book title.     * @return The title.     */    public String getTitle() {        return this.title;    }        /**     * Setter for the book title.     * @param title The new title.     */    public void setTitle(String title) {        this.title = title;    }    /**     * Gets the book's authors.     * @return The list of authors as a String.     */    public String getAuthors() {        return this.authors;    }        /**     * Sets the book authors.     * @param authors The new author list.     */    public void setAuthors(String authors) {        this.authors = authors;    }        /**     * Getter for the book's editor.     * @return The name of the editor.     */    public String getEditor() {        return this.editor;    }        /**     * Setter for the book's editor.     * @param editor The new editor name for this book.     */    public void setEditor(String editor) {        this.editor = editor;    }        /**     * Retrieves the number of pages.     * @return The number of pages in the book.     */    public int getPageCount() {        return this.pageCount;    }        /**     * Sets the number of pages.     * @param pageCount The new number of pages in the book.     */    public void setPageCount(int pageCount) {        this.pageCount = pageCount;    }        /**     * Gets the list of chapters in this book.     * @return The chapters as a String.     */    public String getChapters() {        return this.chapters;    }        /**     * Sets the chapters in the book.     * @param chapters The new list of chapters.     */    public void setChapters(String chapters) {        this.chapters = chapters;    }        /**     * Retrieves the book's retail price.     * @return The book's retail price.     */    public double getPrice() {        return this.price;    }        /**     * Sets the retail price.     * @param price The book's new retail price.     */    public void setPrice(double price) {        this.price = price;    }        /**     * Getter for property status.     * @return Value of property status.     */    public char getStatus() {        return this.status;    }        /**     * Setter for property status. New Book objects start with a status     * <code>PLANNED</code>.     * @param status New value of property status.     */    public void setStatus(char status) {        switch (status) {            case PLANNED:            case IN_PROGRESS:            case COMPLETED:                this.status = status;                break;                       default:                throw new IllegalArgumentException(			"Invalid status " + status);        }    }        /**     * Retrieves the news items for this book.     * @return A SortedSet of BookNews objects associated with this book.     */        public SortedSet getNews() {        return this.news;    }        /**     * Returns a String representation which is mainly useful for     * debugging purposes.     * @return A String representation of this Book.     */        public String toString() {        return "[" + super.toString() + ": " +               "id=" + id + " title=" + title + " authors=" + authors + "]";    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -