bookto.java
来自「主要是对串口驱动的的一些控制源码!!! 在下载javacomm20-win32」· Java 代码 · 共 165 行
JAVA
165 行
package de.fhm.jkf.bookshop.clsv;
import java.io.Externalizable;
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
/**
* <br><br><center><table border="1" width="80%"><hr> <strong><a href="http:
* //jkf.sourceforge.net">The JKF Project</a></strong>
* <p>
* Copyright (C) 2002 by Theodor Willax
* <p>
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
* <p>
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
* <p>
* You should have received a copy of the <a href="http://www.gnu.org/copyleft/lesser.html">
* GNU Lesser General Public License</a> along with this library; if not, write to
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
* <hr></table></center>
*
* @author Theodor Willax
* @version $Revision
*/
public class BookTO implements Externalizable {
private String isbn;
private String title;
private String author;
private Double price;
/**
* Constructor for BookTO.
*/
public BookTO() {
super();
}
/**
* Constructor for BookTO.
*/
public BookTO(String isbn, String title, String author, Double price) {
super();
this.isbn = isbn;
this.title = title;
this.author = author;
this.price = price;
}
/**
* Externalize this instance.
*
* @see java.io.Externalizable#writeExternal(java.io.ObjectOutput)
*/
public void writeExternal(ObjectOutput out) throws IOException {
out.writeUTF(isbn);
out.writeUTF(title);
out.writeUTF(author);
out.writeObject(price);
}
/**
* Un-externalize this instance.
*
* @see java.io.Externalizable#readExternal(java.io.ObjectInput)
*/
public void readExternal(ObjectInput in)
throws IOException, ClassNotFoundException {
isbn = in.readUTF();
title = in.readUTF();
author = in.readUTF();
price = (Double)in.readObject();
}
/**
* Returns the author.
* @return String
*/
public String getAuthor() {
return author;
}
/**
* Returns the isbn.
* @return String
*/
public String getIsbn() {
return isbn;
}
/**
* Returns the price.
* @return Double
*/
public Double getPrice() {
return price;
}
/**
* Returns the title.
* @return String
*/
public String getTitle() {
return title;
}
/**
* Sets the author.
* @param author The author to set
*/
public void setAuthor(String author) {
this.author = author;
}
/**
* Sets the isbn.
* @param isbn The isbn to set
*/
public void setIsbn(String isbn) {
this.isbn = isbn;
}
/**
* Sets the price.
* @param price The price to set
*/
// public void setPrice(Double price) {
// this.price = price;
// }
/**
* Sets the price. Converts from <code>String</code> to
* <code>Double</code>. Necessery for automatic interchange
* with the gui components (TextField).
*
* @param price The price to set
*/
public void setPrice(Object price) {
this.price = Double.valueOf(price.toString());
}
/**
* Sets the title.
* @param title The title to set
*/
public void setTitle(String title) {
this.title = title;
}
/**
* <code>String</code> representation of this book.
*/
public String toString() {
return "Book(" + isbn + "): " + title + " - " + author + " - " + price;
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?