totalcross.lang
Class Class

totalcross.lang.Object
  extended by totalcross.lang.Class

public final class Class
extends totalcross.lang.Object

This class contains utility methods that are used to load classes by name and get information about their fields and methods.

IMPORTANT: the totalcross.lang package is the java.lang that will be used in the device. You CANNOT use nor import totalcross.lang package in desktop. When tc.Deploy is called, all references to java.lang are replaced by totalcross.lang automatically. Given this, you must use only the classes and methods that exists BOTH in java.lang and totalcross.lang. For example, you can't use totalcross.lang.ClassLoader because there are no totalcross.lang.ClassLoader. Another example, you can't use totalcross.lang.String.indexOfIgnoreCase because there are no totalcross.lang.String.indexOfIgnoreCase method. Trying to use a class or method from the java.lang package that has no correspondence with totalcross.lang will make the tc.Deploy program to abort, informing where the problem occured. A good idea is to always refer to this javadoc to know what is and what isn't available.


Constructor Summary
Class()
           
 
Method Summary
static Class forName(String className)
          The TotalCross deployer can find classes that are instantiated using Class.forName if, and only if, they are totalcross.lang.String constants.
 totalcross.lang.reflect.Field getField(String name)
          Not implemented under the TotalCross VM!
 totalcross.lang.reflect.Method getMethod(String name, Class[] parameterTypes)
          Not implemented under the TotalCross VM!
 String getName()
          Returns the fully qualified name of this class.
 Object getResourceAsStream(String name)
          Not implemented under the TotalCross VM!
 Class getSuperclass()
          Not implemented under the TotalCross VM!
 boolean isInstance(Object obj)
          Returns true if the given object is an instance of this class.
 Object newInstance()
          Creates a new instance of this class.
 String toString()
          Returns the fully qualified name of this class.
 
Methods inherited from class totalcross.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Class

public Class()
Method Detail

forName

public static Class forName(String className)
                     throws ClassNotFoundException
The TotalCross deployer can find classes that are instantiated using Class.forName if, and only if, they are totalcross.lang.String constants. If you build the className dynamically, then you must include the file passing it to the tc.Deploy application (the deployer will warn you about that).

Throws:
ClassNotFoundException
See Also:
Vm.attachLibrary(totalcross.lang.String)

newInstance

public Object newInstance()
                   throws totalcross.lang.InstantiationException,
                          totalcross.lang.IllegalAccessException
Creates a new instance of this class.

Throws:
InstantiationException - If you try to instantiate an interface, abstract class or array
IllegalAccessException - If you try to instantiate a private class
totalcross.lang.InstantiationException
totalcross.lang.IllegalAccessException

isInstance

public boolean isInstance(Object obj)
Returns true if the given object is an instance of this class.


getName

public String getName()
Returns the fully qualified name of this class.


toString

public String toString()
Returns the fully qualified name of this class.


getResourceAsStream

public Object getResourceAsStream(String name)
Not implemented under the TotalCross VM! Will crash if used in the device!


getMethod

public totalcross.lang.reflect.Method getMethod(String name,
                                          Class[] parameterTypes)
Not implemented under the TotalCross VM! Will crash if used in the device!


getSuperclass

public Class getSuperclass()
Not implemented under the TotalCross VM! Will crash if used in the device!


getField

public totalcross.lang.reflect.Field getField(String name)
Not implemented under the TotalCross VM! Will crash if used in the device!