std.object.framework.struct

*lead-class*

dynamic

+field-function

+getter-function

dir

added in 3.0

(dir obj)(dir obj path)

explores the fields of a object given a path

(dir “string” [])

(dir “string” :hash)

field-function

added in 3.0

(field-function k cls)

creates a field access function

((field-function :value String) “hello”) => bytes

field-function-raw

(field-function-raw k cls)

helper function for std.object.framework.struct/field-function

getter-function

added in 3.0

(getter-function k cls)

creates a getter function for a keyword

(getter-function :class ’Class) => fn?

getter-function-raw

(getter-function-raw k cls)

helper function for std.object.framework.struct/getter-function

struct-accessor

added in 3.0

(struct-accessor spec)(struct-accessor spec access)

creates an accessor function

((struct-accessor {:value :data :msg :detail-message :value} :field) (ex-info “hello” {:a 1})) => (contains {:value {:a 1}, :msg bytes?})

struct-field-functions

added in 3.0

(struct-field-functions ks cls)

constructs fields access functions

(struct-field-functions :detail-message :value clojure.lang.ExceptionInfo)

struct-fields

added in 3.0

(struct-fields spec obj)

creates a struct given an object and a field map

(struct-fields {:depth []} (ex-info “hello” {:a 1})) => (contains {:depth number?})

(struct-fields {:msg :detail-message :value} (ex-info “hello” {:a 1})) => (contains {:msg bytes?})

struct-getters

added in 3.0

(struct-getters spec obj)

creates a struct given an object and a getter map

(struct-getters {:value :data :message [] :class {:name []}} (ex-info “hello” {:a 1})) => {:value {:a 1}, :message “hello”, :class {:name “clojure.lang.ExceptionInfo”}}