📄 autoimpl.java
字号:
// You can redistribute this software and/or modify it under the terms of
// the Ozone Library License version 1 published by ozone-db.org.
//
// The original code and portions created by SMB are
// Copyright (C) 1997-2000 by SMB GmbH. All rights reserved.
//
// $Id$
package test.simple;
import org.apache.log4j.Category;
import org.ozoneDB.OzoneObject;
import java.util.Enumeration;
import java.util.Vector;
public class AutoImpl extends OzoneObject implements Auto {
/**
* log4j logger
*/
private static Category fLog = Category.getInstance(AutoImpl.class);
/**
* 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;
Vector v;
public AutoImpl() {
// fLog.debug ("Auto ctor...");
v = new Vector();
v.add("dani");
}
public void onCreate() {
fLog.debug("onCreate()...");
// try {
// link = (Auto)database().createObject (BusImpl.class.getName(), 0, null);
// fLog.debug (link.getClass().getName());
// }
// catch (Exception e) {
// fLog.debug (e);
// }
}
public void onDelete() {
fLog.debug("onDelete()...");
if (link != null) {
database().deleteObject(link);
}
}
public boolean equals(Object obj) {
Auto auto = (Auto) obj;
return name.equals(auto.name());
}
public String nameName() throws Exception {
fLog.debug(self());
fLog.debug(((Auto) self()).link());
fLog.debug(((Auto) self()).link().name());
return ((Auto) self()).link().name();
}
public Auto doSomthing(Auto auto) throws Exception {
String linkName = link.name();
fLog.debug("doSomething(): linkName=" + linkName);
return link;
}
public Auto setLink(Auto auto) throws Exception {
// fLog.debug ("setLink(): " + auto.toString() + " (" + auto.getClass().getName() + ")");
link = auto;
return this;
}
public Auto link() {
return link;
}
public void print() {
fLog.debug(toString());
fLog.debug("Vector:");
for (Enumeration e = v.elements(); e.hasMoreElements();) {
fLog.debug(e.nextElement());
}
}
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) {
age = newAge;
return age;
}
public Integer age() {
return new Integer(age);
}
public String toString() {
// fLog.debug ("toString()...");
return "Auto:" + name + ", " + String.valueOf(age);
}
public void done() throws Exception {
// fLog.debug (toString() + " done.");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -