jaxp/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/Repository.java
author chegar
Sun, 17 Aug 2014 15:51:56 +0100
changeset 25868 686eef1e7a79
parent 12457 jaxp/src/com/sun/org/apache/bcel/internal/Repository.java@c348e06f0e82
child 31929 1e2ee502d1be
permissions -rw-r--r--
8054834: Modular Source Code Reviewed-by: alanb, chegar, ihse, mduigou Contributed-by: alan.bateman@oracle.com, alex.buckley@oracle.com, chris.hegarty@oracle.com, erik.joelsson@oracle.com, jonathan.gibbons@oracle.com, karen.kinnear@oracle.com, magnus.ihse.bursie@oracle.com, mandy.chung@oracle.com, mark.reinhold@oracle.com, paul.sandoz@oracle.com
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
6
7f561c08de6b Initial load
duke
parents:
diff changeset
     1
/*
7f561c08de6b Initial load
duke
parents:
diff changeset
     2
 * reserved comment block
7f561c08de6b Initial load
duke
parents:
diff changeset
     3
 * DO NOT REMOVE OR ALTER!
7f561c08de6b Initial load
duke
parents:
diff changeset
     4
 */
7f561c08de6b Initial load
duke
parents:
diff changeset
     5
package com.sun.org.apache.bcel.internal;
7f561c08de6b Initial load
duke
parents:
diff changeset
     6
7f561c08de6b Initial load
duke
parents:
diff changeset
     7
/* ====================================================================
7f561c08de6b Initial load
duke
parents:
diff changeset
     8
 * The Apache Software License, Version 1.1
7f561c08de6b Initial load
duke
parents:
diff changeset
     9
 *
7f561c08de6b Initial load
duke
parents:
diff changeset
    10
 * Copyright (c) 2001 The Apache Software Foundation.  All rights
7f561c08de6b Initial load
duke
parents:
diff changeset
    11
 * reserved.
7f561c08de6b Initial load
duke
parents:
diff changeset
    12
 *
7f561c08de6b Initial load
duke
parents:
diff changeset
    13
 * Redistribution and use in source and binary forms, with or without
7f561c08de6b Initial load
duke
parents:
diff changeset
    14
 * modification, are permitted provided that the following conditions
7f561c08de6b Initial load
duke
parents:
diff changeset
    15
 * are met:
7f561c08de6b Initial load
duke
parents:
diff changeset
    16
 *
7f561c08de6b Initial load
duke
parents:
diff changeset
    17
 * 1. Redistributions of source code must retain the above copyright
7f561c08de6b Initial load
duke
parents:
diff changeset
    18
 *    notice, this list of conditions and the following disclaimer.
7f561c08de6b Initial load
duke
parents:
diff changeset
    19
 *
7f561c08de6b Initial load
duke
parents:
diff changeset
    20
 * 2. Redistributions in binary form must reproduce the above copyright
7f561c08de6b Initial load
duke
parents:
diff changeset
    21
 *    notice, this list of conditions and the following disclaimer in
7f561c08de6b Initial load
duke
parents:
diff changeset
    22
 *    the documentation and/or other materials provided with the
7f561c08de6b Initial load
duke
parents:
diff changeset
    23
 *    distribution.
7f561c08de6b Initial load
duke
parents:
diff changeset
    24
 *
7f561c08de6b Initial load
duke
parents:
diff changeset
    25
 * 3. The end-user documentation included with the redistribution,
7f561c08de6b Initial load
duke
parents:
diff changeset
    26
 *    if any, must include the following acknowledgment:
7f561c08de6b Initial load
duke
parents:
diff changeset
    27
 *       "This product includes software developed by the
7f561c08de6b Initial load
duke
parents:
diff changeset
    28
 *        Apache Software Foundation (http://www.apache.org/)."
7f561c08de6b Initial load
duke
parents:
diff changeset
    29
 *    Alternately, this acknowledgment may appear in the software itself,
7f561c08de6b Initial load
duke
parents:
diff changeset
    30
 *    if and wherever such third-party acknowledgments normally appear.
7f561c08de6b Initial load
duke
parents:
diff changeset
    31
 *
7f561c08de6b Initial load
duke
parents:
diff changeset
    32
 * 4. The names "Apache" and "Apache Software Foundation" and
7f561c08de6b Initial load
duke
parents:
diff changeset
    33
 *    "Apache BCEL" must not be used to endorse or promote products
7f561c08de6b Initial load
duke
parents:
diff changeset
    34
 *    derived from this software without prior written permission. For
7f561c08de6b Initial load
duke
parents:
diff changeset
    35
 *    written permission, please contact apache@apache.org.
7f561c08de6b Initial load
duke
parents:
diff changeset
    36
 *
7f561c08de6b Initial load
duke
parents:
diff changeset
    37
 * 5. Products derived from this software may not be called "Apache",
7f561c08de6b Initial load
duke
parents:
diff changeset
    38
 *    "Apache BCEL", nor may "Apache" appear in their name, without
7f561c08de6b Initial load
duke
parents:
diff changeset
    39
 *    prior written permission of the Apache Software Foundation.
7f561c08de6b Initial load
duke
parents:
diff changeset
    40
 *
7f561c08de6b Initial load
duke
parents:
diff changeset
    41
 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
7f561c08de6b Initial load
duke
parents:
diff changeset
    42
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
7f561c08de6b Initial load
duke
parents:
diff changeset
    43
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
7f561c08de6b Initial load
duke
parents:
diff changeset
    44
 * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
7f561c08de6b Initial load
duke
parents:
diff changeset
    45
 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
7f561c08de6b Initial load
duke
parents:
diff changeset
    46
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
7f561c08de6b Initial load
duke
parents:
diff changeset
    47
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
7f561c08de6b Initial load
duke
parents:
diff changeset
    48
 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
7f561c08de6b Initial load
duke
parents:
diff changeset
    49
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
7f561c08de6b Initial load
duke
parents:
diff changeset
    50
 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
7f561c08de6b Initial load
duke
parents:
diff changeset
    51
 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
7f561c08de6b Initial load
duke
parents:
diff changeset
    52
 * SUCH DAMAGE.
7f561c08de6b Initial load
duke
parents:
diff changeset
    53
 * ====================================================================
7f561c08de6b Initial load
duke
parents:
diff changeset
    54
 *
7f561c08de6b Initial load
duke
parents:
diff changeset
    55
 * This software consists of voluntary contributions made by many
7f561c08de6b Initial load
duke
parents:
diff changeset
    56
 * individuals on behalf of the Apache Software Foundation.  For more
7f561c08de6b Initial load
duke
parents:
diff changeset
    57
 * information on the Apache Software Foundation, please see
7f561c08de6b Initial load
duke
parents:
diff changeset
    58
 * <http://www.apache.org/>.
7f561c08de6b Initial load
duke
parents:
diff changeset
    59
 */
7f561c08de6b Initial load
duke
parents:
diff changeset
    60
7f561c08de6b Initial load
duke
parents:
diff changeset
    61
import com.sun.org.apache.bcel.internal.classfile.JavaClass;
7f561c08de6b Initial load
duke
parents:
diff changeset
    62
import com.sun.org.apache.bcel.internal.util.*;
7f561c08de6b Initial load
duke
parents:
diff changeset
    63
import java.io.*;
7f561c08de6b Initial load
duke
parents:
diff changeset
    64
7f561c08de6b Initial load
duke
parents:
diff changeset
    65
/**
7f561c08de6b Initial load
duke
parents:
diff changeset
    66
 * The repository maintains informations about class interdependencies, e.g.,
7f561c08de6b Initial load
duke
parents:
diff changeset
    67
 * whether a class is a sub-class of another. Delegates actual class loading
7f561c08de6b Initial load
duke
parents:
diff changeset
    68
 * to SyntheticRepository with current class path by default.
7f561c08de6b Initial load
duke
parents:
diff changeset
    69
 *
7f561c08de6b Initial load
duke
parents:
diff changeset
    70
 * @see com.sun.org.apache.bcel.internal.util.Repository
7f561c08de6b Initial load
duke
parents:
diff changeset
    71
 * @see com.sun.org.apache.bcel.internal.util.SyntheticRepository
7f561c08de6b Initial load
duke
parents:
diff changeset
    72
 *
7f561c08de6b Initial load
duke
parents:
diff changeset
    73
 * @author <A HREF="mailto:markus.dahm@berlin.de">M. Dahm</A>
7f561c08de6b Initial load
duke
parents:
diff changeset
    74
 */
7f561c08de6b Initial load
duke
parents:
diff changeset
    75
public abstract class Repository {
7f561c08de6b Initial load
duke
parents:
diff changeset
    76
  private static com.sun.org.apache.bcel.internal.util.Repository _repository =
7f561c08de6b Initial load
duke
parents:
diff changeset
    77
    SyntheticRepository.getInstance();
7f561c08de6b Initial load
duke
parents:
diff changeset
    78
7f561c08de6b Initial load
duke
parents:
diff changeset
    79
  /** @return currently used repository instance
7f561c08de6b Initial load
duke
parents:
diff changeset
    80
   */
7f561c08de6b Initial load
duke
parents:
diff changeset
    81
  public static com.sun.org.apache.bcel.internal.util.Repository getRepository() {
7f561c08de6b Initial load
duke
parents:
diff changeset
    82
    return _repository;
7f561c08de6b Initial load
duke
parents:
diff changeset
    83
  }
7f561c08de6b Initial load
duke
parents:
diff changeset
    84
7f561c08de6b Initial load
duke
parents:
diff changeset
    85
  /** Set repository instance to be used for class loading
7f561c08de6b Initial load
duke
parents:
diff changeset
    86
   */
7f561c08de6b Initial load
duke
parents:
diff changeset
    87
  public static void setRepository(com.sun.org.apache.bcel.internal.util.Repository rep) {
7f561c08de6b Initial load
duke
parents:
diff changeset
    88
    _repository = rep;
7f561c08de6b Initial load
duke
parents:
diff changeset
    89
  }
7f561c08de6b Initial load
duke
parents:
diff changeset
    90
7f561c08de6b Initial load
duke
parents:
diff changeset
    91
  /** Lookup class somewhere found on your CLASSPATH, or whereever the
7f561c08de6b Initial load
duke
parents:
diff changeset
    92
   * repository instance looks for it.
7f561c08de6b Initial load
duke
parents:
diff changeset
    93
   *
7f561c08de6b Initial load
duke
parents:
diff changeset
    94
   * @return class object for given fully qualified class name, or null
7f561c08de6b Initial load
duke
parents:
diff changeset
    95
   * if the class could not be found or parsed correctly
7f561c08de6b Initial load
duke
parents:
diff changeset
    96
   */
7f561c08de6b Initial load
duke
parents:
diff changeset
    97
  public static JavaClass lookupClass(String class_name) {
7f561c08de6b Initial load
duke
parents:
diff changeset
    98
    try {
7f561c08de6b Initial load
duke
parents:
diff changeset
    99
      JavaClass clazz = _repository.findClass(class_name);
7f561c08de6b Initial load
duke
parents:
diff changeset
   100
7f561c08de6b Initial load
duke
parents:
diff changeset
   101
      if(clazz == null) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   102
        return _repository.loadClass(class_name);
7f561c08de6b Initial load
duke
parents:
diff changeset
   103
      } else {
7f561c08de6b Initial load
duke
parents:
diff changeset
   104
        return clazz;
7f561c08de6b Initial load
duke
parents:
diff changeset
   105
      }
7f561c08de6b Initial load
duke
parents:
diff changeset
   106
    } catch(ClassNotFoundException ex) { return null; }
7f561c08de6b Initial load
duke
parents:
diff changeset
   107
  }
7f561c08de6b Initial load
duke
parents:
diff changeset
   108
7f561c08de6b Initial load
duke
parents:
diff changeset
   109
  /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   110
   * Try to find class source via getResourceAsStream().
7f561c08de6b Initial load
duke
parents:
diff changeset
   111
   * @see Class
7f561c08de6b Initial load
duke
parents:
diff changeset
   112
   * @return JavaClass object for given runtime class
7f561c08de6b Initial load
duke
parents:
diff changeset
   113
   */
7f561c08de6b Initial load
duke
parents:
diff changeset
   114
  public static JavaClass lookupClass(Class clazz) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   115
    try {
7f561c08de6b Initial load
duke
parents:
diff changeset
   116
      return _repository.loadClass(clazz);
7f561c08de6b Initial load
duke
parents:
diff changeset
   117
    } catch(ClassNotFoundException ex) { return null; }
7f561c08de6b Initial load
duke
parents:
diff changeset
   118
  }
7f561c08de6b Initial load
duke
parents:
diff changeset
   119
7f561c08de6b Initial load
duke
parents:
diff changeset
   120
  /** @return class file object for given Java class.
7f561c08de6b Initial load
duke
parents:
diff changeset
   121
   */
7f561c08de6b Initial load
duke
parents:
diff changeset
   122
  public static ClassPath.ClassFile lookupClassFile(String class_name) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   123
    try {
7f561c08de6b Initial load
duke
parents:
diff changeset
   124
      return ClassPath.SYSTEM_CLASS_PATH.getClassFile(class_name);
7f561c08de6b Initial load
duke
parents:
diff changeset
   125
    } catch(IOException e) { return null; }
7f561c08de6b Initial load
duke
parents:
diff changeset
   126
  }
7f561c08de6b Initial load
duke
parents:
diff changeset
   127
7f561c08de6b Initial load
duke
parents:
diff changeset
   128
  /** Clear the repository.
7f561c08de6b Initial load
duke
parents:
diff changeset
   129
   */
7f561c08de6b Initial load
duke
parents:
diff changeset
   130
  public static void clearCache() {
7f561c08de6b Initial load
duke
parents:
diff changeset
   131
    _repository.clear();
7f561c08de6b Initial load
duke
parents:
diff changeset
   132
  }
7f561c08de6b Initial load
duke
parents:
diff changeset
   133
7f561c08de6b Initial load
duke
parents:
diff changeset
   134
  /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   135
   * Add clazz to repository if there isn't an equally named class already in there.
7f561c08de6b Initial load
duke
parents:
diff changeset
   136
   *
7f561c08de6b Initial load
duke
parents:
diff changeset
   137
   * @return old entry in repository
7f561c08de6b Initial load
duke
parents:
diff changeset
   138
   */
7f561c08de6b Initial load
duke
parents:
diff changeset
   139
  public static JavaClass addClass(JavaClass clazz) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   140
    JavaClass old = _repository.findClass(clazz.getClassName());
7f561c08de6b Initial load
duke
parents:
diff changeset
   141
    _repository.storeClass(clazz);
7f561c08de6b Initial load
duke
parents:
diff changeset
   142
    return old;
7f561c08de6b Initial load
duke
parents:
diff changeset
   143
  }
7f561c08de6b Initial load
duke
parents:
diff changeset
   144
7f561c08de6b Initial load
duke
parents:
diff changeset
   145
  /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   146
   * Remove class with given (fully qualified) name from repository.
7f561c08de6b Initial load
duke
parents:
diff changeset
   147
   */
7f561c08de6b Initial load
duke
parents:
diff changeset
   148
  public static void removeClass(String clazz) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   149
    _repository.removeClass(_repository.findClass(clazz));
7f561c08de6b Initial load
duke
parents:
diff changeset
   150
  }
7f561c08de6b Initial load
duke
parents:
diff changeset
   151
7f561c08de6b Initial load
duke
parents:
diff changeset
   152
  /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   153
   * Remove given class from repository.
7f561c08de6b Initial load
duke
parents:
diff changeset
   154
   */
7f561c08de6b Initial load
duke
parents:
diff changeset
   155
  public static void removeClass(JavaClass clazz) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   156
    _repository.removeClass(clazz);
7f561c08de6b Initial load
duke
parents:
diff changeset
   157
  }
7f561c08de6b Initial load
duke
parents:
diff changeset
   158
7f561c08de6b Initial load
duke
parents:
diff changeset
   159
  /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   160
   * @return list of super classes of clazz in ascending order, i.e.,
7f561c08de6b Initial load
duke
parents:
diff changeset
   161
   * Object is always the last element
7f561c08de6b Initial load
duke
parents:
diff changeset
   162
   */
7f561c08de6b Initial load
duke
parents:
diff changeset
   163
  public static JavaClass[] getSuperClasses(JavaClass clazz) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   164
    return clazz.getSuperClasses();
7f561c08de6b Initial load
duke
parents:
diff changeset
   165
  }
7f561c08de6b Initial load
duke
parents:
diff changeset
   166
7f561c08de6b Initial load
duke
parents:
diff changeset
   167
  /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   168
   * @return list of super classes of clazz in ascending order, i.e.,
7f561c08de6b Initial load
duke
parents:
diff changeset
   169
   * Object is always the last element. return "null", if class
7f561c08de6b Initial load
duke
parents:
diff changeset
   170
   * cannot be found.
7f561c08de6b Initial load
duke
parents:
diff changeset
   171
   */
7f561c08de6b Initial load
duke
parents:
diff changeset
   172
  public static JavaClass[] getSuperClasses(String class_name) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   173
    JavaClass jc = lookupClass(class_name);
7f561c08de6b Initial load
duke
parents:
diff changeset
   174
    return (jc == null? null : getSuperClasses(jc));
7f561c08de6b Initial load
duke
parents:
diff changeset
   175
  }
7f561c08de6b Initial load
duke
parents:
diff changeset
   176
7f561c08de6b Initial load
duke
parents:
diff changeset
   177
  /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   178
   * @return all interfaces implemented by class and its super
7f561c08de6b Initial load
duke
parents:
diff changeset
   179
   * classes and the interfaces that those interfaces extend, and so on.
7f561c08de6b Initial load
duke
parents:
diff changeset
   180
   * (Some people call this a transitive hull).
7f561c08de6b Initial load
duke
parents:
diff changeset
   181
   */
7f561c08de6b Initial load
duke
parents:
diff changeset
   182
  public static JavaClass[] getInterfaces(JavaClass clazz) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   183
    return clazz.getAllInterfaces();
7f561c08de6b Initial load
duke
parents:
diff changeset
   184
  }
7f561c08de6b Initial load
duke
parents:
diff changeset
   185
7f561c08de6b Initial load
duke
parents:
diff changeset
   186
  /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   187
   * @return all interfaces implemented by class and its super
7f561c08de6b Initial load
duke
parents:
diff changeset
   188
   * classes and the interfaces that extend those interfaces, and so on
7f561c08de6b Initial load
duke
parents:
diff changeset
   189
   */
7f561c08de6b Initial load
duke
parents:
diff changeset
   190
  public static JavaClass[] getInterfaces(String class_name) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   191
    return getInterfaces(lookupClass(class_name));
7f561c08de6b Initial load
duke
parents:
diff changeset
   192
  }
7f561c08de6b Initial load
duke
parents:
diff changeset
   193
7f561c08de6b Initial load
duke
parents:
diff changeset
   194
  /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   195
   * Equivalent to runtime "instanceof" operator.
7f561c08de6b Initial load
duke
parents:
diff changeset
   196
   * @return true, if clazz is an instance of super_class
7f561c08de6b Initial load
duke
parents:
diff changeset
   197
   */
7f561c08de6b Initial load
duke
parents:
diff changeset
   198
  public static boolean instanceOf(JavaClass clazz, JavaClass super_class) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   199
    return clazz.instanceOf(super_class);
7f561c08de6b Initial load
duke
parents:
diff changeset
   200
  }
7f561c08de6b Initial load
duke
parents:
diff changeset
   201
7f561c08de6b Initial load
duke
parents:
diff changeset
   202
  /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   203
   * @return true, if clazz is an instance of super_class
7f561c08de6b Initial load
duke
parents:
diff changeset
   204
   */
7f561c08de6b Initial load
duke
parents:
diff changeset
   205
  public static boolean instanceOf(String clazz, String super_class) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   206
    return instanceOf(lookupClass(clazz), lookupClass(super_class));
7f561c08de6b Initial load
duke
parents:
diff changeset
   207
  }
7f561c08de6b Initial load
duke
parents:
diff changeset
   208
7f561c08de6b Initial load
duke
parents:
diff changeset
   209
  /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   210
   * @return true, if clazz is an instance of super_class
7f561c08de6b Initial load
duke
parents:
diff changeset
   211
   */
7f561c08de6b Initial load
duke
parents:
diff changeset
   212
  public static boolean instanceOf(JavaClass clazz, String super_class) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   213
    return instanceOf(clazz, lookupClass(super_class));
7f561c08de6b Initial load
duke
parents:
diff changeset
   214
  }
7f561c08de6b Initial load
duke
parents:
diff changeset
   215
7f561c08de6b Initial load
duke
parents:
diff changeset
   216
  /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   217
   * @return true, if clazz is an instance of super_class
7f561c08de6b Initial load
duke
parents:
diff changeset
   218
   */
7f561c08de6b Initial load
duke
parents:
diff changeset
   219
  public static boolean instanceOf(String clazz, JavaClass super_class) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   220
    return instanceOf(lookupClass(clazz), super_class);
7f561c08de6b Initial load
duke
parents:
diff changeset
   221
  }
7f561c08de6b Initial load
duke
parents:
diff changeset
   222
7f561c08de6b Initial load
duke
parents:
diff changeset
   223
  /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   224
   * @return true, if clazz is an implementation of interface inter
7f561c08de6b Initial load
duke
parents:
diff changeset
   225
   */
7f561c08de6b Initial load
duke
parents:
diff changeset
   226
  public static boolean implementationOf(JavaClass clazz, JavaClass inter) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   227
    return clazz.implementationOf(inter);
7f561c08de6b Initial load
duke
parents:
diff changeset
   228
  }
7f561c08de6b Initial load
duke
parents:
diff changeset
   229
7f561c08de6b Initial load
duke
parents:
diff changeset
   230
  /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   231
   * @return true, if clazz is an implementation of interface inter
7f561c08de6b Initial load
duke
parents:
diff changeset
   232
   */
7f561c08de6b Initial load
duke
parents:
diff changeset
   233
  public static boolean implementationOf(String clazz, String inter) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   234
    return implementationOf(lookupClass(clazz), lookupClass(inter));
7f561c08de6b Initial load
duke
parents:
diff changeset
   235
  }
7f561c08de6b Initial load
duke
parents:
diff changeset
   236
7f561c08de6b Initial load
duke
parents:
diff changeset
   237
  /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   238
   * @return true, if clazz is an implementation of interface inter
7f561c08de6b Initial load
duke
parents:
diff changeset
   239
   */
7f561c08de6b Initial load
duke
parents:
diff changeset
   240
  public static boolean implementationOf(JavaClass clazz, String inter) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   241
    return implementationOf(clazz, lookupClass(inter));
7f561c08de6b Initial load
duke
parents:
diff changeset
   242
  }
7f561c08de6b Initial load
duke
parents:
diff changeset
   243
7f561c08de6b Initial load
duke
parents:
diff changeset
   244
  /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   245
   * @return true, if clazz is an implementation of interface inter
7f561c08de6b Initial load
duke
parents:
diff changeset
   246
   */
7f561c08de6b Initial load
duke
parents:
diff changeset
   247
  public static boolean implementationOf(String clazz, JavaClass inter) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   248
    return implementationOf(lookupClass(clazz), inter);
7f561c08de6b Initial load
duke
parents:
diff changeset
   249
  }
7f561c08de6b Initial load
duke
parents:
diff changeset
   250
}