Java interop question

2009-01-11 Thread wal

Is it possible to access a constant inside a public static class which
is defined inside a public interface?

For example:

package com.rabbitmq.client;

import java.io.IOException;
[...skipped...]

public interface AMQP
{
public static class PROTOCOL {
public static final int MAJOR = 8;
public static final int MINOR = 0;
public static final int PORT = 5672;
}

public static final int FRAME_METHOD = 1;
public static final int FRAME_HEADER = 2;
public static final int FRAME_BODY = 3;

[...skipped...]
}

I did a lot of experimentartion in the REPL, but no success yet - I
can't figure out how to access com.rabbimq.client.AMQP.PROTOCOL.PORT
constant in Clojure.

It is possible to (import 'com.rabbitmq.client.AMQP), but (import
'com.rabbitmq.client.AMQP.PROTOCOL) gives ClassNotFoundException.

(. com.rabbimq.AMQP FRAME_METHOD) returns 1, but neither (.
com.rabbitmq.client.AMQP.PROTOCOL PORT), nor
(com.rabbitmq.client.AMQP.PROTOCOL/PORT) works.

What I'm doing wrong?

Best regards,
Vladimir

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



Re: Java interop question

2009-01-11 Thread wal

On 12 янв, 01:01, Chouser  wrote:
> On Sun, Jan 11, 2009 at 3:30 PM, wal  wrote:
>
> > Is it possible to access a constant inside a public static class which
> > is defined inside a public interface?
>
> > For example:
>
> > package com.rabbitmq.client;
>
> > import java.io.IOException;
> > [...skipped...]
>
> > public interface AMQP
> > {
> >    public static class PROTOCOL {
> >        public static final int MAJOR = 8;
> >        public static final int MINOR = 0;
> >        public static final int PORT = 5672;
> >    }
>
> >    public static final int FRAME_METHOD = 1;
> >    public static final int FRAME_HEADER = 2;
> >    public static final int FRAME_BODY = 3;
>
> > [...skipped...]
> > }
>
> Probably com.rabbitmq.client.AMQP$PROTOCOL/PORT without parens since
> it's a field not a method.
>
> Documented athttp://clojure.org/java_interop-- search for NestedClass
>
> --Chouser

Yes, it worked! Thanks a lot!
--~--~-~--~~~---~--~~
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
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
-~--~~~~--~~--~--~---