img Jay02

NakedObjects框架: 最快最省构建漂亮合理的Java程序

发表于2002/7/4 10:02:00  613人阅读

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. 
>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){
    protected void configureLogging() throws ConfigurationException {
    protected ObjectStore installObjectStore() throws ConfigurationException {
     return new XMLObjectStore();

0 0



取 消