Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Here's a Java generic pattern: public <T> T getResultData(Class<T> resultClass, other_args) { ... return resultClass.cast(T-thing); } A typical call looks like: DoubleBuffer buffer; buffer = thing.getResultData(DoubleBuffer.class, args); I've never been able to figure out how to use this pattern cleanly when the desired return type is, itself, generic. To be 'conc...
I have been trying to determine the type of a field in a class. I've seen all the introspection methods but haven't quite figured out how to do it. This is going to be used to generate xml/json from a java class. I've looked at a number of the questions here but haven't found exactly what I need. Example: class Person { public final String name; public final List<Person> childre...
Is there a common reflection approach to find out whether java method returns a set of objects like array, list, set, collection and other iterable subinterfaces? The story behind is that I need to inspect third-party method's return type and say two things: Does method return set of objects (in human sense)? If yes - what is the component type? For example if method's return type is Vecto...
 /*
  * Copyright 2003 Sun Microsystems, Inc.  All Rights Reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.  Sun designates this
  * particular file as subject to the "Classpath" exception as provided
  * by Sun in the LICENSE file that accompanied this code.
 *
 * This code is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 * version 2 for more details (a copy is included in the LICENSE file that
 * accompanied this code).
 *
 * You should have received a copy of the GNU General Public License version
 * 2 along with this work; if not, write to the Free Software Foundation,
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 *
 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
 * CA 95054 USA or visit www.sun.com if you need additional information or
 * have any questions.
 */
package java.lang.reflect;

Type is the common superinterface for all types in the Java programming language. These include raw types, parameterized types, array types, type variables and primitive types.

Since:
1.5
public interface Type {
New to GrepCode? Check out our FAQ X