<script type="text/javascript"> function Generator() {}; Generator.prototype.rand = Math.floor(Math.random() * 26) + Date.now(); Generator.prototype.getId = function() { return this.rand++; }; var idGen =new Generator(); </script> </html> <body> <!-- Place this in the body of the page content --> <button onclick="console.log(idGen.getId())">click</button> </body>
public class MyGenerator { public static void main(String args[]) throws Exception { (...) new Generator().generateAll(schema, args[0]); } }
Generator g = new Generator(2 /* length of resulting strings */); for (String s : g) System.out.println(s);
public static void main(String [] args) { Scanner scan = new Scanner(System.in); Generator gen = new Generator (); System.out.println("Enter the string you want to process"); String equation = scan.nextLine(); double result = calc.solve(equation); System.out.println("Result is: " + result); }
public class MyBean { Integer someInt; Double someDoub; public Integer getSomeInt(){ if (someInt == null) someInt = GeneratorUtil.createAndEvaluate(); return someInt; } public Double getSomeDoub(){ if (someDoub == null) someDoub = GeneratorUtil().createAndEvaluate(); return someDoub; } } public class GeneratorUtil { @SuppressWarnings("unchecked") public static <T> T createAndEvaluate() { return (T) new Generator().evaluate(); } }
import java.lang.reflect.Method; import java.nio.charset.Charset; import java.util.Locale; import net.sf.cglib.proxy.Mixin; import net.sf.cglib.proxy.Mixin.Generator; public class CglibTest { public static void main(String[] args) throws Exception { Generator gen = new Generator(); gen.setStyle(Mixin.STYLE_EVERYTHING); gen.setDelegates(new Object[]{ Charset.defaultCharset(), Locale.getDefault()}); Mixin mixin = gen.create(); System.out.println(invokeMethod(mixin, "displayName")); System.out.println(invokeMethod(mixin, "getCountry")); } public static Object invokeMethod(Object target, String methodName) throws Exception { Method method = target.getClass().getMethod(methodName); return method.invoke(target); } }
import org.jooq.util.jaxb.*; // [...] Configuration configuration = new Configuration() .withJdbc(new Jdbc() .withDriver("com.mysql.jdbc.Driver") .withUrl("jdbc:mysql://localhost:3306/library") .withUser("root") .withPassword("root")) .withGenerator(new Generator() .withName("org.jooq.util.DefaultGenerator") .withDatabase(new Database() .withName("org.jooq.util.mysql.MySQLDatabase") .withIncludes(".*") .withExcludes("") .withInputSchema("library")) .withTarget(new Target() .withPackageName("org.jooq.util.maven.example") .withDirectory("target/generated-sources/jooq"))); GenerationTool.main(configuration);
for(int i = 0; i < 3; i++){ Generator generator = new Generator();
import org.jooq.util.GenerationTool; import org.jooq.util.jaxb.*; Configuration configuration = new Configuration() .withJdbc(new Jdbc() .withDriver("org.postgresql.Driver") .withUrl("jdbc:postgresql://localhost/your_database") .withUser("username") .withPassword("password")) .withGenerator(new Generator() .withName("org.jooq.util.DefaultGenerator") .withDatabase(new Database() .withName("org.jooq.util.postgres.PostgresDatabase") .withIncludes(".*") .withSchemata(new Schema().withInputSchema("your_schema")) ) .withTarget(new Target() .withPackageName("jooq.generate") .withDirectory("src/main/java"))); try { GenerationTool.generate(configuration); } catch (Exception e) { e.printStackTrace(); }
.withGenerator(new Generator() .withName("org.jooq.util.DefaultGenerator") .withDatabase(new Database()
Node.Nodes page) throws JasperException { Generator gen = new Generator(out, compiler);
Node.Nodes page) throws JasperException { Generator gen = new Generator(out, compiler);
throws JasperException { Generator gen = new Generator(out, compiler);
throws JasperException { Generator gen = new Generator(out, compiler);
Node.Nodes page) throws JasperException { Generator gen = new Generator(out, compiler);
throws JasperException { Generator gen = new Generator(out, compiler);
Node.Nodes page) throws JasperException { Generator gen = new Generator(out, compiler);
Node.Nodes page) throws JasperException { Generator gen = new Generator(out, compiler);
Node.Nodes page) throws JasperException { Generator gen = new Generator(out, compiler);
Node.Nodes page) throws JasperException { Generator gen = new Generator(out, compiler);