Support for using Clojure functions in Java APIs requiring a SAM (Single Abstrace Method) interface.
Currently uses java.lang.invoke.MethodHandleProxies to convert an method handle to a SAM type. The method handle generated for the IFn will translate to something akin to the below (using method handle notation for signatures):
(-> SAM call (Object...)Object[] RT.seq(Object[])ISeq IFN.applyTo(ISeq)Object)
This is not intended to be highly performant, but, as it has not been benchmarked, may or may not be. It is mainly intended to provide a more convenient interop with Java APIs that take SAM arguments.
Support for using Clojure functions in Java APIs requiring a SAM (Single Abstrace Method) interface. Currently uses java.lang.invoke.MethodHandleProxies to convert an method handle to a SAM type. The method handle generated for the IFn will translate to something akin to the below (using method handle notation for signatures): (-> SAM call (Object...)Object[] RT.seq(Object[])ISeq IFN.applyTo(ISeq)Object) This is not intended to be highly performant, but, as it has not been benchmarked, may or may not be. It is mainly intended to provide a more convenient interop with Java APIs that take SAM arguments.
(defsam name docstring? attr-map? sami & fdecl)
Defines a SAM instance bound to a Var named using the symbol passed in the first argument. Optional docstring and/or attribute map can be passed next. The following argument will be the SAM interface that should be implemented. The remaining arguments are treated as if to clojure.core/fn.
Defines a SAM instance bound to a Var named using the symbol passed in the first argument. Optional docstring and/or attribute map can be passed next. The following argument will be the SAM interface that should be implemented. The remaining arguments are treated as if to clojure.core/fn.
(sam sami & forms)
Defines an anonymous SAM instance implementing the SAM interface in the first argument. Remaining arguments are treated as if to clojure.core/fn.
Defines an anonymous SAM instance implementing the SAM interface in the first argument. Remaining arguments are treated as if to clojure.core/fn.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close