Janandith,

I think the problem with this code is that you try to cast a key of the key set to a Node.

interpreter.bind("bindings" , "javax.script.Bindings" , bindings);

Then I use the bindings to get the Node.
// The ';' is for interpreter to separate lines.

import javax.util._;
import javax.jcr._;
import org.apache.jackrabbit.core._;

var x = bindings.keyset().iterator();
var y = x.next();
// continu until get "currentNode"
var currentNode = x.next()

var node = x.get(curentNode);
-------------^

x is an iterator on the keyset of the bindings object.

Michael


after that I cannot cast the java.lang.Object to a javax.jcr.Node.
I've tried the following,

//Method 1.
var cast = (Node)node;

//Method 2
var cast = node.asInstanceOf(Node);

//Method 3 using match
var cast:Node =Object match {
  case x:Node => x
  case _ => null
}

//Method 4
type Id[T] = T => T;

val id = new Node[Any,Id]{ def Apply[T <: Any] : Id[T] = id[T] _ };
val node = id.Apply[Node];
node(g);

but it is not possible. I would be grateful if you could guide me to the correct way of doing this cast.

Janandith.


Reply via email to