/** * Create an instance of {@link Strategy } * */ public Strategy createStrategy() { return new Strategy(); }
public Strategy withName(String value) { setName(value); return this; }
public Strategy withMatchers(Matchers value) { setMatchers(value); return this; }
g.setStrategy(new Strategy()); if (g.getTarget() == null) g.setTarget(new Target()); Matchers matchers = g.getStrategy().getMatchers(); if (matchers != null) { strategy = new MatcherStrategy(matchers); if (g.getStrategy().getName() != null) { if (!DefaultGeneratorStrategy.class.getName().equals(g.getStrategy().getName())) log.warn("WARNING: Matchers take precedence over custom strategy. Strategy ignored: " + g.getStrategy().getName()); g.getStrategy().setName(null); Class<GeneratorStrategy> strategyClass = (Class<GeneratorStrategy>) (!isBlank(g.getStrategy().getName()) ? loadClass(trim(g.getStrategy().getName())) : DefaultGeneratorStrategy.class); strategy = strategyClass.newInstance();
public static void codegen() throws Exception { List<ForcedType> forcedTypes = JooqConfig.defaultForcedTypes(); HikariDataSource ds = CMSConnectionPools.processing(); Configuration configuration = new Configuration() .withJdbc(new Jdbc() .withDriver(Driver.class.getName()) .withUrl(ds.getJdbcUrl()) .withUser(ds.getUsername()) .withPassword(ds.getPassword())) .withGenerator(new Generator() .withDatabase(new Database() .withName(MySQLDatabase.class.getName()) .withIncludes(".*") .withExcludes("") .withIncludeExcludeColumns(true) .withForcedTypes(forcedTypes) .withInputSchema("sj_cms")) .withGenerate(new Generate() .withJavaTimeTypes(true)) .withStrategy(new Strategy() .withName(CustomGeneratorStrategy.class.getName())) .withTarget(new Target() .withPackageName("com.stubbornjava.cms.server.generated") .withDirectory("src/generated/java"))); GenerationTool.generate(configuration); }
@Override public int hashCode() { final int prime = 31; int result = 1; result = ((prime*result)+((name == null)? 0 :name.hashCode())); result = ((prime*result)+((strategy == null)? 0 :strategy.hashCode())); result = ((prime*result)+((database == null)? 0 :database.hashCode())); result = ((prime*result)+((generate == null)? 0 :generate.hashCode())); result = ((prime*result)+((target == null)? 0 :target.hashCode())); return result; }
if (!strategy.equals(other.strategy)) { return false;