Ignore:
Timestamp:
12/03/03 11:13:20 (18 years ago)
Author:
asimon
Message:

removed JCLASS-FOR-NAME
added three more convenience functions for Java reflection

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/j/src/org/armedbear/lisp/java.lisp

    r4947 r4953  
    22;;;
    33;;; Copyright (C) 2003 Peter Graves
    4 ;;; $Id: java.lisp,v 1.8 2003-12-02 22:29:59 dmcnaught Exp $
     4;;; $Id: java.lisp,v 1.9 2003-12-03 11:13:20 asimon Exp $
    55;;;
    66;;; This program is free software; you can redistribute it and/or
     
    2727  (jcall (jmethod "java.lang.Class" "getName") class))
    2828
    29 (defun jclass-for-name (name)
    30   "Returns the class of name NAME"
    31   (jstatic "forName" "java.lang.Class" name))
    32 
    3329(defun jobject-class (obj)
    3430  "Returns the Java class that OBJ belongs to"
     
    5248  "Returns T if CLASS is an interface"
    5349  (jcall (jmethod "java.lang.Class" "isInterface") (ensure-jclass class)))
     50
     51(defun jclass-superclass-p (class-1 class-2)
     52  "Returns T if CLASS-1 is a superclass or interface of CLASS-2"
     53  (jcall (jmethod "java.lang.Class" "isAssignableFrom" "java.lang.Class")
     54   (ensure-jclass class-1)
     55   (ensure-jclass class-2)))
     56
     57(defun jclass-array-p (class)
     58  "Returns T if CLASS is an array class"
     59  (jcall (jmethod "java.lang.Class" "isArray") (ensure-jclass class)))
     60
     61(defun jarray-component-type (atype)
     62  "Returns the component type of the array type ATYPE"
     63  (assert (jclass-array-p atype))
     64  (jcall (jmethod "java.lang.Class" "getComponentType") atype))
    5465
    5566(defun jclass-constructors (class)
Note: See TracChangeset for help on using the changeset viewer.