• (call-method klass method-name params obj & args)
Calls a private or protected method.

params is a vector of classes which correspond to the arguments to
the method e

obj is nil for static methods, the instance object otherwise.

The method-name is given a symbol or a keyword (something Named).

0 Examples top

Log in to add / edit an example.

See Also top

Log in to add a see also.

Plus_12x12 Minus_12x12 Source clojure/contrib/reflect.clj:12 top

(defn call-method
  "Calls a private or protected method.

   params is a vector of classes which correspond to the arguments to
   the method e

   obj is nil for static methods, the instance object otherwise.

   The method-name is given a symbol or a keyword (something Named)."
  [klass method-name params obj & args]
  (-> klass (.getDeclaredMethod (name method-name)
                                (into-array Class params))
      (doto (.setAccessible true))
      (.invoke obj (into-array Object args))))
Vars in clojure.contrib.reflect/call-method: -> defn doto into-array name
Used in 0 other vars

Comments top

No comments for call-method. Log in to add a comment.