WEB开发网
开发学院软件开发Java 面向 Java 开发人员的 db4o 指南: 查询,更新和一... 阅读

面向 Java 开发人员的 db4o 指南: 查询,更新和一致性

 2010-04-01 00:00:00 来源:WEB开发网   
核心提示: 清单 1. Person 类 packagecom.tedneward.model;publicclassPerson{publicPerson(){}publicPerson(StringfirstName,StringlastName,intage){this.firstName=first

清单 1. Person 类

        package com.tedneward.model; 
 
public class Person 
{ 
  public Person() 
  { } 
  public Person(String firstName, String lastName, int age) 
  { 
    this.firstName = firstName; 
    this.lastName = lastName; 
    this.age = age; 
  } 
   
  public String getFirstName() { return firstName; } 
  public void setFirstName(String value) { firstName = value; } 
   
  public String getLastName() { return lastName; } 
  public void setLastName(String value) { lastName = value; } 
   
  public int getAge() { return age; } 
  public void setAge(int value) { age = value; } 
 
  public String toString() 
  { 
    return 
      "[Person: " + 
      "firstName = " + firstName + " " + 
      "lastName = " + lastName + " " + 
      "age = " + age + 
      "]"; 
  } 
   
  public boolean equals(Object rhs) 
  { 
    if (rhs == this) 
      return true; 
     
    if (!(rhs instanceof Person)) 
      return false; 
     
    Person other = (Person)rhs; 
    return (this.firstName.equals(other.firstName) && 
        this.lastName.equals(other.lastName) && 
        this.age == other.age); 
  } 
   
  private String firstName; 
  private String lastName; 
  private int age; 
} 

上一页  1 2 3 4 5 6 7  下一页

Tags:面向 Java 开发

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接