NakedObjects框架: 最快最省构建漂亮合理的Java程序
2002-07-04 10:02
323 查看
NakedObjects框架: 最快最省构建漂亮合理的Java程序
一、说明:
基于nakedobjects.org的nakedobjects0.6.6 framework。
其理念是:将类及其实例直接交由用户操纵,而不是隐藏在传统的用户界面之后。
原文摘录:‘Naked objects’ are core business objects, such as Customer,
Product, and Order, that show directly through to the user, rather than
being hidden behind the menus, forms, process-scripts and dialogue boxes
that make up most user interfaces. In a naked object system,
all operations are performed either by invoking a business behaviour
on a particular object, editing the attributes of an object, or
specifying an association between objects.
了解具体信息及下载Framework可登陆http://www.nakedobjects.org/
二、编译运行示例:
>javac -classpath ../../lib/nakedobjects.jar;../../lib/log4j.jar;../../
lib/xerces.jar;classes;. Run.java
三、示例程序(地址簿):
// Address.java
import org.nakedobjects.object.*;
public class Address extends NakedObject {
private final TextString name = new TextString();
private final TextString address = new TextString();
private final TextString telephone = new TextString();
private final TextString mobile = new TextString();
private final TextString email = new TextString();
public TextString getName() {
return name;
}
public TextString getAddress() {
return address;
}
public TextString getTelephone() {
return telephone;
}
public TextString getMobile() {
return mobile;
}
public TextString getEmail() {
return email;
}
public Title title() {
return name.title();
}
}
// Run.java
import org.nakedobjects.*;
import org.nakedobjects.object.ClassSet;
import org.nakedobjects.utility.ConfigurationException;
import org.nakedobjects.object.ObjectStore;
import org.nakedobjects.xmlpersistence.XMLObjectStore;
import org.apache.log4j.Category;
import org.apache.log4j.Priority;
public class Run extends DefaultApplication {
public static void main(String args[]){
new Run();
}
public void classSet(ClassSet set){
set.addClass(Address.class);
}
protected void configureLogging() throws ConfigurationException {
super.configureLogging();
Category.getDefaultHierarchy().disable(Priority.INFO);
}
protected ObjectStore installObjectStore() throws ConfigurationException {
return new XMLObjectStore();
}
}
一、说明:
基于nakedobjects.org的nakedobjects0.6.6 framework。
其理念是:将类及其实例直接交由用户操纵,而不是隐藏在传统的用户界面之后。
原文摘录:‘Naked objects’ are core business objects, such as Customer,
Product, and Order, that show directly through to the user, rather than
being hidden behind the menus, forms, process-scripts and dialogue boxes
that make up most user interfaces. In a naked object system,
all operations are performed either by invoking a business behaviour
on a particular object, editing the attributes of an object, or
specifying an association between objects.
了解具体信息及下载Framework可登陆http://www.nakedobjects.org/
二、编译运行示例:
>javac -classpath ../../lib/nakedobjects.jar;../../lib/log4j.jar;../../
lib/xerces.jar;classes;. Run.java
三、示例程序(地址簿):
// Address.java
import org.nakedobjects.object.*;
public class Address extends NakedObject {
private final TextString name = new TextString();
private final TextString address = new TextString();
private final TextString telephone = new TextString();
private final TextString mobile = new TextString();
private final TextString email = new TextString();
public TextString getName() {
return name;
}
public TextString getAddress() {
return address;
}
public TextString getTelephone() {
return telephone;
}
public TextString getMobile() {
return mobile;
}
public TextString getEmail() {
return email;
}
public Title title() {
return name.title();
}
}
// Run.java
import org.nakedobjects.*;
import org.nakedobjects.object.ClassSet;
import org.nakedobjects.utility.ConfigurationException;
import org.nakedobjects.object.ObjectStore;
import org.nakedobjects.xmlpersistence.XMLObjectStore;
import org.apache.log4j.Category;
import org.apache.log4j.Priority;
public class Run extends DefaultApplication {
public static void main(String args[]){
new Run();
}
public void classSet(ClassSet set){
set.addClass(Address.class);
}
protected void configureLogging() throws ConfigurationException {
super.configureLogging();
Category.getDefaultHierarchy().disable(Priority.INFO);
}
protected ObjectStore installObjectStore() throws ConfigurationException {
return new XMLObjectStore();
}
}
相关文章推荐
- Java实现时间日期格式转换示例
- Java下利用Jackson进行JSON解析和序列化示例
- Java的几个重要版本_动力节点Java学院整理
- Java Web开发之信息查询方式总结
- 基于Java字符编码的使用详解
- java获取Date时间的各种方式汇总
- Java使用AES加密和解密的实例详解
- 基于java时区转换夏令时的问题及解决方法
- ATL实现Connection Point的一种简单的方法
- 使用 .NET 框架将现有代码作为 Web 服务提供
- Java 2 Micro Edition简介(二)
- Inside Java2 SDK Source Internal 深入Java2 SDK原始码(一) Java2 SDK原始码概观
- Java 2 Micro Edition简介(四)
- Java 2 Micro Edition简介(三)
- 利用Java 编写手机应用程序 Motorola iDEN篇
- 调试利器-----------------------DebugTrace for Windows简介
- 鼠标消息处理流程
- Microsoft Agent 学习笔记 (一)
- 用MFC构造DirectX应用框架