;;;; *************************************************************************
;;;; FILE IDENTIFICATION
;;;;
-;;;; Name: hyperobject-plain-example.lisp
-;;;; Purpose: Hyper Object Metaclass
+;;;; Name: hyperobject-example.lisp
+;;;; Purpose: Hyperobject Example file
;;;; Programmer: Kevin M. Rosenberg
-;;;; Date Started: Apr 2000
+;;;; Date Started: Oct 2002
;;;;
-;;;; This metaclass as functions to classes to allow display
-;;;; in Text, HTML, and XML formats. This includes hyperlinking
-;;;; capability and sub-objects.
+;;;; A simple example file for hyperobjects
;;;;
-;;;; $Id: example.lisp,v 1.1 2002/11/22 10:49:24 kevin Exp $
+;;;; $Id: example.lisp,v 1.5 2002/11/23 18:41:45 kevin Exp $
;;;;
;;;; This file is Copyright (c) 2000-2002 by Kevin M. Rosenberg
;;;;
(in-package :hyperobject-user)
-(define-hyperobject person ()
- ((first-name :type string :reference find-person-by-last-name)
- (last-name :type string)
- (dob :type integer :initform 0 :format-func format-date)
- (resume :type cdata)
- (addresses :subobject t))
- (:title "Person")
- (:documentation "Person hyperobject class"))
+
+(defclass person (hyperobject)
+ ((first-name :type string :initarg :first-name :reader first-name)
+ (last-name :type string :initarg :last-name :reader last-name
+ :reference find-person-by-last-name)
+ (dob :type integer :initarg :dob :reader dob :print-formatter format-date)
+ (resume :type cdata :initarg :resume :reader resume)
+ (addresses :initarg :addresses :reader addresses :subobject t))
+ (:metaclass hyperobject-class)
+ (:default-initargs :first-name nil :last-name nil :dob 0 :resume nil)
+ (:print-slots first-name last-name dob resume)
+ (:title "Person"))
(defun format-date (ut)
(when (typep ut 'integer)
year
hr min sec))))
-(define-hyperobject address ()
- ((title :type string)
- (street :type string)
- (phones :subobject t))
+(defclass address (hyperobject)
+ ((title :type string :initarg :title :reader title)
+ (street :type string :initarg :street :reader street)
+ (phones :initarg :phones :reader phones :subobject t))
+ (:metaclass hyperobject-class)
+ (:default-initargs :title nil :street nil)
(:title "Address")
- (:documentation "Address hyperobject"))
+ (:print-slots title street))
-(define-hyperobject phone ()
- ((phone-number :type string))
+(defclass phone (hyperobject)
+ ((phone-number :type string :initarg :phone-number :reader phone-number))
+ (:metaclass hyperobject-class)
(:title "Phone Number")
- (:documentation "Phone hyperobject"))
+ (:default-initargs :phone-number nil)
+ (:print-slots phone-number))
(defparameter home-phone-1 (make-instance 'phone :phone-number "367-9812"))