From 8702ff03ba84342f1b5bf89e65e6ddd402c77fec Mon Sep 17 00:00:00 2001 From: juerg Date: Mon, 11 Mar 2024 09:17:42 +0100 Subject: [PATCH] update java interop doc --- doc/readme/java-interop.md | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/doc/readme/java-interop.md b/doc/readme/java-interop.md index 40b7b7d9b..c53bfc6b8 100644 --- a/doc/readme/java-interop.md +++ b/doc/readme/java-interop.md @@ -102,20 +102,24 @@ can be sorted and Java types can be used with sets and maps. Java _enum_ values can be passed as simple or scoped keywords: ```clojure -(do - (import :java.time.LocalDate) - - (. :LocalDate :of 1994 :JANUARY 21) - (. :LocalDate :of 1994 :java.time.Month.JANUARY 21)) +(. :java.time.LocalDate :of 1994 :JANUARY 21) +;; => 1994-01-21 + +(. :java.time.LocalDate :of 1994 :java.time.Month.JANUARY 21) +;; => 1994-01-21 ``` Get a Java _enum_ value ```clojure (. :java.time.Month :JANUARY) +;; => JANUARY + +(type (. :java.time.Month :JANUARY)) +;; => :java.time.Month ``` -Pass a Java _enum_ value as a function argument +Pass a Java _enum_ value to a function ```clojure (let [jan (. :java.time.Month :JANUARY)] @@ -126,6 +130,7 @@ Get all values of a Java _enum_ ```clojure (. :java.time.Month :values) +;; => [JANUARY FEBRUARY MARCH APRIL MAY JUNE JULY AUGUST SEPTEMBER OCTOBER NOVEMBER DECEMBER] ``` @@ -167,9 +172,9 @@ public class OuterClass { -## Java VarArgs +## Java Varargs -Java varargs are passed as list or vector: +Java _Varargs_ are passed as list or vector: ```clojure ; Java signature: String String::format(String format, Object... args) @@ -183,6 +188,7 @@ Java varargs are passed as list or vector: ``` + ## Dynamic Proxies The Venice `proxify` function creates implementations for *Java Interfaces*