@Test public void testBasicInjection() { GetUserInfoResult userInfo = new GetUserInfoResult(); userInfo.setOrganizationName("testBasicSelect UserInfo"); DescribeSObjectResult dsr = new DescribeSObjectResult(); dsr.setName("testBasicSelect DescribeSObjectResult"); Field field = new Field(); field.setName("Field__c"); StringTemplateWrapper template = new StringTemplateWrapper("$packageName$ $userInfo.organizationName$ $objectInfo.name$ $fields:{f | $f.name$ }$"); new ForceJPAClassTemplateInjector().inject(userInfo, dsr, Collections.<Field>singletonList(field), template); assertEquals(template.toString(), "com.testbasicselectuserinfo.model testBasicSelect UserInfo testBasicSelect DescribeSObjectResult Field__c ", "Unexpected template after Force.com JPA class data select"); }
@Override public void inject(GetUserInfoResult userInfo, DescribeSObjectResult dsr, List<Field> fieldList, Template template) { if (packageName != null) { template.injectView("packageName", packageName); } else { template.injectView("packageName", ForceJPAClassGeneratorUtils.constructPackageName(userInfo)); } template.injectView("userInfo", userInfo); template.injectView("objectInfo", dsr); template.injectView("fields", fieldList); }
ForceJPAClassTemplateInjector implements TemplateInjector { @Override public void inject(GetUserInfoResult userInfo, DescribeSObjectResult dsr, List<Field> fieldList, Template template) { if (packageName != null) { template.injectView("packageName", packageName); } else { template.injectView("packageName", ForceJPAClassGeneratorUtils.constructPackageName(userInfo)); } template.injectView("userInfo", userInfo); template.injectView("objectInfo", dsr); template.injectView("fields", fieldList); } }
ForceJPAClassTemplateInjector implements TemplateInjector { @Override public void inject(GetUserInfoResult userInfo, DescribeSObjectResult dsr, List<Field> fieldList, Template template) { if (packageName != null) { template.injectView("packageName", packageName); } else { template.injectView("packageName", ForceJPAClassGeneratorUtils.constructPackageName(userInfo)); } template.injectView("userInfo", userInfo); template.injectView("objectInfo", dsr); template.injectView("fields", fieldList); }  }
ForceJPAClassTemplateInjector implements TemplateInjector { @Override public void inject(GetUserInfoResult userInfo, DescribeSObjectResult dsr, List<Field> fieldList, Template template) { if (packageName != null) { template.injectView("packageName", packageName); } else { template.injectView("packageName", ForceJPAClassGeneratorUtils.constructPackageName(userInfo)); } template.injectView("userInfo", userInfo); template.injectView("objectInfo", dsr); template.injectView("fields", fieldList); }  void setPackageName(String packageName); @Override void inject(GetUserInfoResult userInfo, DescribeSObjectResult dsr, List<Field> fieldList, Template template); }
ForceJPAClassTemplateInjector implements TemplateInjector { @Override public void inject(GetUserInfoResult userInfo, DescribeSObjectResult dsr, List<Field> fieldList, Template template) { if (packageName != null) { template.injectView("packageName", packageName); } else { template.injectView("packageName", ForceJPAClassGeneratorUtils.constructPackageName(userInfo)); } template.injectView("userInfo", userInfo); template.injectView("objectInfo", dsr); template.injectView("fields", fieldList); }  void setPackageName(String packageName); @Override void inject(GetUserInfoResult userInfo, DescribeSObjectResult dsr, List<Field> fieldList, Template template);  }