Decent method for as2-type

This commit is contained in:
Marcus Kammer 2024-10-04 10:02:03 +02:00
parent d3a42aabaf
commit 4a14037444
Signed by: marcuskammer
GPG key ID: C374817BE285268F

View file

@ -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)