public DomainExporter(String namePrefix, String nameSuffix, File targetFolder, SerializerConfig serializerConfig, Configuration configuration) { this.targetFolder = targetFolder; this.serializerConfig = serializerConfig; this.configuration = configuration; CodegenModule module = new CodegenModule(); module.bind(CodegenModule.PREFIX, namePrefix); module.bind(CodegenModule.SUFFIX, nameSuffix); module.bind(CodegenModule.KEYWORDS, Collections.<String> emptySet()); this.queryTypeFactory = module.get(QueryTypeFactory.class); this.typeMappings = module.get(TypeMappings.class); this.entitySerializer = module.get(EntitySerializer.class); typeFactory.setUnknownAsEntity(true); }
@Test(expected=IllegalArgumentException.class) public void Get_With_Unknown_Key() { module.get(String.class, "XXX"); }
@Override protected void configure() { super.configure(); bind(NamingStrategy.class, DefaultNamingStrategy.class); bind(Configuration.class, new Configuration(SQLTemplates.DEFAULT)); bind(Serializer.class, MetaDataSerializer.class); bind(QueryTypeFactory.class, SQLQueryTypeFactory.class); bind(BEAN_SERIALIZER, (Class<?>)null); bind(INNER_CLASSES_FOR_KEYS, false); bind(BEAN_PREFIX, ""); bind(BEAN_SUFFIX, ""); bind(BEAN_PACKAGE_NAME, "com.example"); bind(PACKAGE_NAME, "com.example"); bind(BEAN_SERIALIZER, (Class<?>)null); bind(SCHEMA_TO_PACKAGE, false); bindInstance(ENTITYPATH_TYPE, RelationalPathBase.class); bind(COLUMN_COMPARATOR, null); }
@Test public void DefaultPrefix() { assertEquals("Q", module.get(String.class, CodegenModule.PREFIX)); }
/** * @param namePrefix * @param nameSuffix * @param targetFolder * @param serializerConfig * @param charset */ @SuppressWarnings("unchecked") public AbstractDomainExporter(String namePrefix, String nameSuffix, File targetFolder, SerializerConfig serializerConfig, Charset charset) { this.targetFolder = targetFolder; this.serializerConfig = serializerConfig; this.charset = charset; CodegenModule module = new CodegenModule(); module.bind(CodegenModule.PREFIX, namePrefix); module.bind(CodegenModule.SUFFIX, nameSuffix); module.bind(CodegenModule.KEYWORDS, Constants.keywords); this.queryTypeFactory = module.get(QueryTypeFactory.class); this.typeMappings = module.get(TypeMappings.class); this.embeddableSerializer = module.get(EmbeddableSerializer.class); this.entitySerializer = module.get(EntitySerializer.class); this.supertypeSerializer = module.get(SupertypeSerializer.class); this.variableNameFunction = module.get(Function.class, CodegenModule.VARIABLE_NAME_FUNCTION_CLASS); }
@Test public void TypeMappings() { assertNotNull(module.get(TypeMappings.class)); }