Skip to content

Commit

Permalink
update java interop doc
Browse files Browse the repository at this point in the history
  • Loading branch information
juerg committed Mar 11, 2024
1 parent 17a3bad commit 8702ff0
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions doc/readme/java-interop.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand All @@ -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]
```


Expand Down Expand Up @@ -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)
Expand All @@ -183,6 +188,7 @@ Java varargs are passed as list or vector:
```



## Dynamic Proxies

The Venice `proxify` function creates implementations for *Java Interfaces*
Expand Down

0 comments on commit 8702ff0

Please sign in to comment.