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

📄 sellercontactinfo.java

📁 仿照著名的petstore写的网上书店
💻 JAVA
字号:
/* Copyright 2006 Sun Microsystems, Inc. All rights reserved. You may not modify, use, reproduce, or distribute this software except in compliance with the terms of the License at: http://developer.sun.com/berkeley_license.html$Id: SellerContactInfo.java,v 1.5 2007/01/09 19:02:11 basler Exp $ */package com.sun.javaee.blueprints.petstore.model;import com.sun.javaee.blueprints.petstore.util.PetstoreUtil;import java.util.ArrayList;import javax.persistence.Entity;import javax.persistence.GeneratedValue;import javax.persistence.GenerationType;import javax.persistence.Id;import javax.persistence.TableGenerator;@Entity        public class SellerContactInfo implements java.io.Serializable {        private String contactInfoID;    private String lastName;    private String firstName;    private String email;        public SellerContactInfo() { }    public SellerContactInfo(String firstName, String lastName,            String email) {        this.firstName = firstName;        this.lastName = lastName;        this.email = email;    }        @TableGenerator(name="CONTACTINFO_ID_GEN",            table="ID_GEN",            pkColumnName="GEN_KEY",            valueColumnName="GEN_VALUE",            pkColumnValue="CONTACT_INFO_ID",            allocationSize=1)            @GeneratedValue(strategy=GenerationType.TABLE,generator="CONTACTINFO_ID_GEN")            @Id            public String getContactInfoID() {        return contactInfoID;    }        public String getLastName() {        return lastName;    }        public String getFirstName() {        return firstName;    }        public String getEmail() {        return email;    }        public void setEmail(String email) {        this.email = email;    }    public void setContactInfoID(String contactInfoID) {        this.contactInfoID = contactInfoID;    }    public void setLastName(String lastName) {        this.lastName = lastName;    }    public void setFirstName(String firstName) {        this.firstName = firstName;    }        /**     * This method checks to make sure the class values are valid     *     * @return Message(s) of validation errors or and empty array (zero length) if class is valid     */    public String[] validateWithMessage() {        ArrayList<String> valMess=new ArrayList<String>();                // make sure make and address is entered        if(firstName == null || firstName.equals("")) {            // price should be a number            valMess.add(PetstoreUtil.getMessage("invalid_contact_firstname"));        }        if(lastName == null || lastName.equals("")) {            valMess.add(PetstoreUtil.getMessage("invalid_contact_lastname"));        }                    return valMess.toArray(new String[valMess.size()]);    }    }

⌨️ 快捷键说明

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