Name

jcast — Cast a Java object into an other one.

Calling Sequence

      jcast(javaObject, class)
    

Parameters

javaObject

A mlist typed _JObj

class

A string giving the class name or a mlist typed _JClass got with jimport or jcompile

Description

Gives the possisbility to cast an object into another one with the given class if it is possible.

Examples

      
               jimport java.lang.Double;
	       jimport java.lang.Number;

               d = Double.new("1.23456");
               jgetclassname(d)
               e = jcast(d, "java.lang.Number");
	       // or as an alternative
	       f = jcast(d, Number);
               jgetclassname(e)
               jremove e d f;
      

See Also

jgetclassname

Author

Calixte Denizet