一、java.lang.reflect.Type
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.
public interface Type {
/**
* Returns a string describing this type, including information
* about any type parameters.
*/
default String getTypeName() {
return toString();
}
}
说明:Class类也是Type接口的子类,所以:
public void bind(Type type) {
System.out.println(type.getTypeName());
}
bind(Test.class); //测试调用
上面的测试会输出Test类的完整的名称(即包含包名)