/** * gets GeneratorPredicate from condition * * @param cond * Condition * @return GeneratorPredicate */ private GeneratorPredicate getGP(Condition cond) { GeneratorPredicate gp = new GeneratorPredicate(); // ===================when assignable to if (cond instanceof ConditionWhenTypeAssignableTo) { gp.setEPredict(EPredicts.ASSIGNABLE); gp.setName(GeneratorPredicate.CLASS); gp.setValue(((ConditionWhenTypeAssignableTo) cond) .getAssignableToTypeName()); // ===================when type is } else if (cond instanceof ConditionWhenTypeIs) { gp.setEPredict(EPredicts.TYPEIS); gp.setName(GeneratorPredicate.CLASS); gp.setValue((String) getPrivateField(cond, "exactTypeName")); // ===================when property is } else if (cond instanceof ConditionWhenPropertyIs) { gp.setEPredict(EPredicts.PROPERTY); gp.setName((String) getPrivateField( ((ConditionWhenPropertyIs) cond), "propName")); gp.setValue((String) getPrivateField( ((ConditionWhenPropertyIs) cond), "value")); } return gp; }
GeneratorChain.replacers = new LinkedList<AbstractGenerator>(); GeneratorChain.thirdPartyGenerators = new LinkedHashMap<Generator, AbstractGenerator>(); ModuleDef moduleDef = ((CompilerContext) getPrivateField(context, "compilerContext")).getModule(); Rules rules = moduleDef.getRules(); String replaceClass = (String) getPrivateField(rul, "replacementTypeName"); gen = new ReplaceByGenerator(replaceClass); Class<? extends Generator> generatorClass = (Class<? extends Generator>)getPrivateField(rul, "generatorClass"); Constructor<?> constructor; try {