Decent method for as2-type
This commit is contained in:
parent
d3a42aabaf
commit
4a14037444
1 changed files with 10 additions and 1 deletions
11
src/as2.lisp
11
src/as2.lisp
|
@ -6,6 +6,7 @@
|
||||||
#:define-property-methods
|
#:define-property-methods
|
||||||
#:object
|
#:object
|
||||||
#:link
|
#:link
|
||||||
|
#:as2-type
|
||||||
#:attachment
|
#:attachment
|
||||||
#:attributed-to
|
#:attributed-to
|
||||||
#:audience
|
#:audience
|
||||||
|
@ -61,7 +62,15 @@
|
||||||
|
|
||||||
(defmethod initialize-instance :after ((obj property-container) &key)
|
(defmethod initialize-instance :after ((obj property-container) &key)
|
||||||
(setf (gethash "type" (properties obj))
|
(setf (gethash "type" (properties obj))
|
||||||
(string-capitalize (class-name (class-of obj)))))
|
(kebab-camel (string-capitalize (class-name (class-of obj))))))
|
||||||
|
|
||||||
|
(defgeneric as2-type (property-container &optional value))
|
||||||
|
|
||||||
|
(defmethod as2-type ((obj property-container) &optional value)
|
||||||
|
(if value
|
||||||
|
(prog1 obj
|
||||||
|
(setf (gethash "type" (properties obj)) value))
|
||||||
|
(gethash "type" (properties obj))))
|
||||||
|
|
||||||
(defmacro define-property-method (class-name name)
|
(defmacro define-property-method (class-name name)
|
||||||
`(defmethod ,name ((obj ,class-name) &optional value)
|
`(defmethod ,name ((obj ,class-name) &optional value)
|
||||||
|
|
Loading…
Add table
Reference in a new issue