What Alex suggested is probably the best approach here. Note: there's a typo in my message, the name of the class needs to be as Alex says for the type hint too, i.e. the L and ; are essential for this to work.
> On 9 Oct 2017, at 18:31, pericles macedo <periclesmac...@gmail.com> wrote: > > Hey Gary, thanks for the help > I'm not sure if a type hint would work in this case, as the attribute expect > a class literal, and not a variable of that specific class. Thanks for the > example though, I didn't know that was a valid type hint. > About what I'm trying to do, I'm using a gitlab api gem > (https://github.com/timols/java-gitlab-api), and I need to do some java > interop with it. > I'm trying to get a list of projects filtered by name, but the call java does > doesn't build the search attribute, so I just get all projects, not filtered > by name. > I'm able to get on java by using something like > `connection.retrieve().getAll(buildUrl(project), GitlabProject[].class);`. > The getAll expects a string, and a class literal. > If the return from gitlab wasn't an array, I could just use GitlabProject on > clojure, and that would give me a result. As it's an array, I get an error > showing it can't build a GitlabProject out of ARRAY_START. > > My solution to make that call was > (def get-project > > (memoize > > (fn [project] > > (-> connection > > .retrieve > > (.getAll (build-url project) (array-class-for > GitlabProject)))))) > > > (defn array-class-for [class-name] > > (class (make-array class-name 1))) > > > >> On Monday, October 9, 2017 at 9:20:37 AM UTC-7, Gary Verhaegen wrote: >> You can generally use ^"[fully.qualified.ClassName" as the type hint, if >> that's what you're trying to do. I'm not quite sure of the benefits of >> typing an array when it's not a primitive one, though. >> >> What are you trying to accomplish, if we zoom back a little bit? Maybe >> there's a better way to do whatever you're trying to do. >> >>> On 9 Oct 2017, at 16:36, pericles macedo <pericle...@gmail.com> wrote: >>> >>> Hey Guys, >>> I wanted to know if there is a better way to get to the same result as >>> `GitlabProject[].class` >>> after some digging around, I got to this array of class definition by doing >>> something like `(class (make-array GitlabProject 1))`. But I don't know if >>> there is a better way to get to this same result. >>> In Java, this array of class is sent as an attribute that is used to build >>> the array of objects that is returned. like: `retrieve().getAll(tailUrl, >>> GitlabProject[].class);` >>> >>> >>> Thanks for your time, >>> Pericles Dantas >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "Clojure" group. >>> To post to this group, send email to clo...@googlegroups.com >>> Note that posts from new members are moderated - please be patient with >>> your first post. >>> To unsubscribe from this group, send email to >>> clojure+u...@googlegroups.com >>> For more options, visit this group at >>> http://groups.google.com/group/clojure?hl=en >>> --- >>> You received this message because you are subscribed to the Google Groups >>> "Clojure" group. >>> To unsubscribe from this group and stop receiving emails from it, send an >>> email to clojure+u...@googlegroups.com. >>> For more options, visit https://groups.google.com/d/optout. > > -- > You received this message because you are subscribed to the Google > Groups "Clojure" group. > To post to this group, send email to clojure@googlegroups.com > Note that posts from new members are moderated - please be patient with your > first post. > To unsubscribe from this group, send email to > clojure+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/clojure?hl=en > --- > You received this message because you are subscribed to the Google Groups > "Clojure" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to clojure+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.