⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 basicgenerator.java

📁 看thinkinjava学习java时
💻 JAVA
字号:
package myutils;

public class BasicGenerator<T> implements Generator<T>{
	private Class<T> type;
	public BasicGenerator(Class<T> type){this.type = type;
	}
	public T next(){
		try{
		//Assumes type is a public class
		return type.newInstance();
	}catch(Exception e){
		throw new RuntimeException(e);
	}
	}

	//Produce a Default generator given a type token;
	 
	public static <T> Generator<T> create(Class<T> type) {
		return new BasicGenerator<T>(type);
		

	}
	
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -