Thanks for your answers.

On 18 fév, 10:10, Hannes Wallnoefer <[email protected]> wrote:
> On Feb 17, 5:03 pm, Daryl Stultz <[email protected]> wrote:
>
>
>
> > On Tue, Feb 16, 2010 at 11:14 AM, jg <[email protected]> wrote:
> > > Hi all,
>
> > > sorry if this question is trivial... but I don't know how to deal with
> > > this in js, and specifically in rhino shell...
>
> > > Say, I have an enum like
> > >    enum Cardsuit { CLUBS, DIAMONDS, SPADES, HEARTS }
>
> > > how do I use it in Rhino?
>
> > > Well, this is how I use them, which may not be what you want since it puts
>
> > the values at the top level. Before running the script:
>
> > ScriptableObject.*putProperty*(scope, "CLUBS", 
> > Context.*javaToJS*(Cardsuit.*CLUBS*, scope));
>
> That's obviously a solution. But it would be nice (and I think that's
> what the original poster meant) to have a pure JS solution that works
> via Rhino's Java class wrapper. The obvious solution would be to
> expose enum values as properties of the enum class, e.g.
> Cardsuit.CLUBS (or actually OuterClass[$|.]Cardsuit.CLUBS).
> Hannes

Just to make precisions about what I intended to do. I tried to test
neo4j from the shell, but I need enum
see on their Getting Started page: 
http://wiki.neo4j.org/content/Getting_Started_Guide
    public enum MyRelationshipTypes implements RelationshipType
{ KNOWS }
so I was puzzled!
In fact RelationshipType("KNOWS") worked out, but still not a nice
solution.

So I was expected a JavaAdapter of some sort, but couldn't find any
documentation.

Another coming difficulty is the usage of annotation.
eg  taken on http://code.google.com/p/jo4neo/
public class User {
 @neo(index=true) public String screenName;
...}
All these Java-5.0 things should be mentionned on the documentation (I
might have overlooked them). That said, it might not be the role of JS
to be a 100% Java scripting tool, as intended by other contenders like
Groovy. I don't know.

I've never used Scriptable or ScriptableObject, so
    ScriptableObject.*putProperty*(scope, "CLUBS",
Context.*javaToJS*(Cardsuit.*CLUBS*, scope));
didn't  make sense to me. Where to learn about it apart from the terse
Javadoc?

Thanks again for your time.
jg
_______________________________________________
dev-tech-js-engine-rhino mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-js-engine-rhino

Reply via email to