Is there a way to reference nested static members of Java classes
using Clojure?  I tried a few things and couldn't get it to work.  To
simplify the question a bit, I wrote the following Java class:

package org.tomko.konkordans;

public class NestedStatics {
    public static String FOO = "foo";
    public static class LevelOne {
        public static enum LevelTwo {
            YES,NO;
        }
    }
}

Then, at the REPL:

user=> (str org.tomko.konkordans.NestedStatics/FOO)
"foo"
user=> (str.org.tomko.konkordans.NestedStatics/LevelOne)
java.lang.ClassNotFoundException:
str.org.tomko.konkordans.NestedStatics (NO_SOURCE_FILE:0)
user=>

So, it's clear that I have the NestedStatics class in my classpath,
and that I can reference static members that are of a fundamental data
type.  But attempting to reach in one level deeper does not succeed.

I also tried importing LevelOne into my namespace using a :use, but
that didn't work - although I'm a bit hazy on the precise syntax for
that so it might be my fault.  A search in this forum didn't turn up
anything quite like this, but there was some discussion about import
statics that might be relevant.

-- 
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

Reply via email to