/[classpath]/classpath/gnu/java/lang/reflect/TypeSignature.java
ViewVC logotype

Diff of /classpath/gnu/java/lang/reflect/TypeSignature.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.10 by ericb, Fri Mar 22 21:25:20 2002 UTC revision 1.11 by glavaux, Tue Dec 2 18:35:51 2003 UTC
# Line 139  public class TypeSignature Line 139  public class TypeSignature
139     * accepts both object and descriptor formats, but must know which style     * accepts both object and descriptor formats, but must know which style
140     * of string is being passed in (usually, descriptor should be true). In     * of string is being passed in (usually, descriptor should be true). In
141     * descriptor format, "I" is treated as int.class, in object format, it     * descriptor format, "I" is treated as int.class, in object format, it
142     * is treated as a class named I in the unnamed package.     * is treated as a class named I in the unnamed package. This method is
143       * strictly equivalent to {@link #getClassForEncoding(java.lang.String, boolean, java.lang.ClassLoader)}
144       * with a class loader equal to <code>null</code>. In that case, it
145       * uses the default class loader on the calling stack.
146     *     *
147     * @param type_code the class name to decode     * @param type_code the class name to decode
148     * @param descriptor if the string is in descriptor format     * @param descriptor if the string is in descriptor format
# Line 150  public class TypeSignature Line 153  public class TypeSignature
153    public static Class getClassForEncoding(String type_code, boolean descriptor)    public static Class getClassForEncoding(String type_code, boolean descriptor)
154      throws ClassNotFoundException      throws ClassNotFoundException
155    {    {
156        return getClassForEncoding(type_code, descriptor, null);
157      }
158    
159      /**
160       * This function is the inverse of <code>getEncodingOfClass</code>. This
161       * accepts both object and descriptor formats, but must know which style
162       * of string is being passed in (usually, descriptor should be true). In
163       * descriptor format, "I" is treated as int.class, in object format, it
164       * is treated as a class named I in the unnamed package.
165       *
166       * @param type_code The class name to decode.
167       * @param descriptor If the string is in descriptor format.
168       * @param loader The class loader when resolving generic object name. If
169       * <code>loader</code> is null then it uses the default class loader on the
170       * calling stack.
171       * @return the corresponding Class object.
172       * @throws ClassNotFoundException if the class cannot be located.
173       * @see #getEncodingOfClass(Class, boolean)
174       * @see #getClassForEncoding(String, boolean)
175       */
176       public static Class getClassForEncoding(String type_code, boolean descriptor, ClassLoader loader)
177        throws ClassNotFoundException
178      {
179      if (descriptor)      if (descriptor)
180        {        {
181          switch (type_code.charAt(0))          switch (type_code.charAt(0))
# Line 181  public class TypeSignature Line 207  public class TypeSignature
207            case '[':            case '[':
208            }            }
209        }        }
210      return Class.forName(type_code.replace('/', '.'));      return Class.forName(type_code.replace('/', '.'), true, loader);
211    }    }
212    
213    /**    /**

Legend:
Removed from v.1.10  
changed lines
  Added in v.1.11

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26