Description
As far as I am aware there is no abstract class or interface for an Entity
. As these objects only return data it would be nice to be able to test for them. I am working with clojure, and to return clojure maps I perform a recursive traversal of entity objects.
I would like to propose an abstract class that all Entity objects inherit from.
Currently the only way to test if an object is an "entity" - ie it is not a handle to a db nor is it a returned document (BaseDocument excepted) is an entity - is to get the package name from the object and compare it against "com.arangodb.entity".
Problem - For example a multiDocumentEntity may have DocumentCreateEntity or VPackSlice under the field documents
- this is dependent on context - did the user insert multiple documents or get multiple documents etc... One approach currently is
(defn is-entity? [obj]
(when obj
(= "com.arangodb.entity" (-> obj class .getPackage .getName))))
But having to extract package information (and hope that it is correct) is not ideal.