autoimpl.java

来自「Java的面向对象数据库系统的源代码」· Java 代码 · 共 89 行

JAVA
89
字号
// $Id: AutoImpl.java,v 1.2 2002/09/02 09:00:32 per_nyfelt Exp $

import org.ozoneDB.*;


public class AutoImpl extends OzoneObject implements Auto {
    
    /**
     * The serialization version id used by the Java serialization.
     * Please, see also the Java documentation.
     */
    final static long serialVersionUID = 1L;
    
    String name = "Ford";
    
    int age = 0;
    
    Auto link;
    
    
    public AutoImpl() {
        System.out.println( getClass().getName() + " ctor..." );
    }
    
    
    public boolean equals( Object obj ) {
        Auto auto = (Auto)obj;
        return name.equals( auto.name() );
    } 
    
    
    public Auto doSomething( Auto auto ) throws Exception {
        System.out.println( "got: " + auto.toString() + " (" + auto.getClass().getName() + ")" );
        return this;
    } 
    
    
    public Auto setLink( Auto auto ) throws Exception {
        // System.out.println ("setLink(): " + auto.toString() + " (" + auto.getClass().getName() + ")");
        link = auto;
        return this;
    } 
    
    
    public void print() {
        System.out.println( toString() );
    } 
    
    
    public void setName( String newName ) {
        name = newName;
    } 
    
    
    public String name() {
        return name;
    } 
    
    
    public void setAge( Integer newAge ) {
        age = newAge.intValue();
    // throw new NullPointerException();
    } 
    
    
    public int setAge( int newAge ) {
        int result = age;
        age = newAge;
        return result;
    } 
    
    
    public Integer age() {
        return new Integer( age );
    } 
    
    
    public String toString() {
        // System.out.println ("toString()...");
        return "Auto:" + name + ", " + String.valueOf( age );
    } 
    
    
    public void done() throws Exception {
    // System.out.println (toString() + " done.");
    } 
    
}

⌨️ 快捷键说明

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