Javascript [Electronic resources] : The Definitive Guide (4th Edition) نسخه متنی

اینجــــا یک کتابخانه دیجیتالی است

با بیش از 100000 منبع الکترونیکی رایگان به زبان فارسی ، عربی و انگلیسی

Javascript [Electronic resources] : The Definitive Guide (4th Edition) - نسخه متنی

David Flanagan

| نمايش فراداده ، افزودن یک نقد و بررسی
افزودن به کتابخانه شخصی
ارسال به دوستان
جستجو در متن کتاب
بیشتر
تنظیمات قلم

فونت

اندازه قلم

+ - پیش فرض

حالت نمایش

روز نیمروز شب
جستجو در لغت نامه
بیشتر
لیست موضوعات
توضیحات
افزودن یادداشت جدید

Availability


Netscape 3 LiveConnect


Synopsis

getClass(javaobj)

Arguments


javaobj

A JavaObject object.


Returns


The JavaClass object of javaobj.


Description


getClass(
) is a function that takes a JavaObject object (
javaobj) as an argument. It returns the
JavaClass object of that JavaObject. That is, it returns the
JavaClass object that represents the Java class of the Java object
represented by the specified JavaObject.


Usage


Don't confuse the JavaScript getClass( )
function with the

getClass method of all Java
objects. Similarly, don't confuse the JavaScript JavaClass
object with the Java

java.lang.Class class.

Consider the Java Rectangle object created with the following line:

var r = new java.awt.Rectangle(  );

r is a JavaScript variable that holds a JavaObject
object. Calling the JavaScript function getClass(
) returns a JavaClass object that represents the

java.awt.Rectangle  class:

var c = getClass(r); 

You can see this by comparing this JavaClass object to
java.awt.Rectangle:

if (c == java.awt.Rectangle) ... 

The Java getClass( ) method is invoked differently
and performs an entirely different function:

c = r.getClass(  ); 

After executing the above line of code, c is a
JavaObject that represents a java.lang.Class
object. This java.lang.Class object is a Java
object that is a Java representation of the

java.awt.Rectangle class. See your Java
documentation for details on what you can do with the

java.lang.Class class.

To summarize, you can see that the following expression always
evaluates to true for any JavaObject
o:

(getClass(o.getClass(  )) == java.lang.Class) 


See Also


JavaArray, JavaClass, JavaObject, JavaPackage, the
java property of the Window object; Chapter 22

/ 844