@Test public void defaultValue() { CodegenConfig codegenConfig = CodegenConfigLoader.forName("ServiceComb"); Assert.assertEquals(ServiceCombCodegen.class, codegenConfig.getClass()); ServiceCombCodegen serviceCombCodegen = (ServiceCombCodegen) codegenConfig; serviceCombCodegen.processOpts(); Map<String, Object> additionalProperties = serviceCombCodegen.additionalProperties(); Assert.assertEquals("domain.orgnization.project.sample", additionalProperties.get("mainClassPackage")); Assert.assertEquals("domain.orgnization.project.sample.api", additionalProperties.get("apiPackage")); Assert.assertEquals("domain.orgnization.project.sample.model", additionalProperties.get("modelPackage")); }
@Override public void processOpts() { super.processOpts(); importMapping.put("OffsetDateTime", "java.time.OffsetDateTime"); additionalProperties.put("dateLibrary", "java8"); additionalProperties.put("camelcase", new CamelCaseLambda()); additionalProperties.put("getGenericClassType", new GetGenericClassTypeLambda()); additionalProperties.put("getRelativeBasePath", new GetRelativeBasePathLambda()); additionalProperties.put("applicationId", applicationId); additionalProperties.put("library", getLibrary()); additionalProperties.put("outputFolder", outputFolder); additionalProperties.put("apiTemplateFiles", apiTemplateFiles); additionalProperties.put("apiTestTemplateFiles", apiTestTemplateFiles); additionalProperties.put("modelTemplateFiles", modelTemplateFiles); additionalProperties.put("apiDocTemplateFiles", apiDocTemplateFiles); if (additionalProperties.get(ProjectMetaConstant.SERVICE_ID) != null) { serviceId = (String) additionalProperties.get(ProjectMetaConstant.SERVICE_ID); } additionalProperties.put(ProjectMetaConstant.SERVICE_ID, serviceId); currentDirectoryStrategy = getStrategyMap() .get(Optional.ofNullable(additionalProperties.get(ProjectMetaConstant.SERVICE_TYPE)) .orElse(ServiceType.ALL.getValue())); currentDirectoryStrategy.addCustomProperties(additionalProperties); currentDirectoryStrategy.processSupportingFile(supportingFiles); }
ServiceCombCodegen extends AbstractJavaCodegenExt { @Override public void processOpts() { super.processOpts(); importMapping.put("OffsetDateTime", "java.time.OffsetDateTime"); additionalProperties.put("dateLibrary", "java8"); additionalProperties.put("camelcase", new CamelCaseLambda()); additionalProperties.put("getGenericClassType", new GetGenericClassTypeLambda()); additionalProperties.put("getRelativeBasePath", new GetRelativeBasePathLambda()); additionalProperties.put("applicationId", applicationId); additionalProperties.put("library", getLibrary()); additionalProperties.put("outputFolder", outputFolder); additionalProperties.put("apiTemplateFiles", apiTemplateFiles); additionalProperties.put("apiTestTemplateFiles", apiTestTemplateFiles); additionalProperties.put("modelTemplateFiles", modelTemplateFiles); additionalProperties.put("apiDocTemplateFiles", apiDocTemplateFiles); if (additionalProperties.get(ProjectMetaConstant.SERVICE_ID) != null) { serviceId = (String) additionalProperties.get(ProjectMetaConstant.SERVICE_ID); } additionalProperties.put(ProjectMetaConstant.SERVICE_ID, serviceId); currentDirectoryStrategy = getStrategyMap() .get(Optional.ofNullable(additionalProperties.get(ProjectMetaConstant.SERVICE_TYPE)) .orElse(ServiceType.ALL.getValue())); currentDirectoryStrategy.addCustomProperties(additionalProperties); currentDirectoryStrategy.processSupportingFile(supportingFiles); } }
ServiceCombCodegen extends AbstractJavaCodegenExt { @Override public void processOpts() { super.processOpts(); importMapping.put("OffsetDateTime", "java.time.OffsetDateTime"); additionalProperties.put("dateLibrary", "java8"); additionalProperties.put("camelcase", new CamelCaseLambda()); additionalProperties.put("getGenericClassType", new GetGenericClassTypeLambda()); additionalProperties.put("getRelativeBasePath", new GetRelativeBasePathLambda()); additionalProperties.put("applicationId", applicationId); additionalProperties.put("library", getLibrary()); additionalProperties.put("outputFolder", outputFolder); additionalProperties.put("apiTemplateFiles", apiTemplateFiles); additionalProperties.put("apiTestTemplateFiles", apiTestTemplateFiles); additionalProperties.put("modelTemplateFiles", modelTemplateFiles); additionalProperties.put("apiDocTemplateFiles", apiDocTemplateFiles); if (additionalProperties.get(ProjectMetaConstant.SERVICE_ID) != null) { serviceId = (String) additionalProperties.get(ProjectMetaConstant.SERVICE_ID); } additionalProperties.put(ProjectMetaConstant.SERVICE_ID, serviceId); currentDirectoryStrategy = getStrategyMap() .get(Optional.ofNullable(additionalProperties.get(ProjectMetaConstant.SERVICE_TYPE)) .orElse(ServiceType.ALL.getValue())); currentDirectoryStrategy.addCustomProperties(additionalProperties); currentDirectoryStrategy.processSupportingFile(supportingFiles); } ServiceCombCodegen(); }
ServiceCombCodegen extends AbstractJavaCodegenExt { @Override public void processOpts() { super.processOpts(); importMapping.put("OffsetDateTime", "java.time.OffsetDateTime"); additionalProperties.put("dateLibrary", "java8"); additionalProperties.put("camelcase", new CamelCaseLambda()); additionalProperties.put("getGenericClassType", new GetGenericClassTypeLambda()); additionalProperties.put("getRelativeBasePath", new GetRelativeBasePathLambda()); additionalProperties.put("applicationId", applicationId); additionalProperties.put("library", getLibrary()); additionalProperties.put("outputFolder", outputFolder); additionalProperties.put("apiTemplateFiles", apiTemplateFiles); additionalProperties.put("apiTestTemplateFiles", apiTestTemplateFiles); additionalProperties.put("modelTemplateFiles", modelTemplateFiles); additionalProperties.put("apiDocTemplateFiles", apiDocTemplateFiles); if (additionalProperties.get(ProjectMetaConstant.SERVICE_ID) != null) { serviceId = (String) additionalProperties.get(ProjectMetaConstant.SERVICE_ID); } additionalProperties.put(ProjectMetaConstant.SERVICE_ID, serviceId); currentDirectoryStrategy = getStrategyMap() .get(Optional.ofNullable(additionalProperties.get(ProjectMetaConstant.SERVICE_TYPE)) .orElse(ServiceType.ALL.getValue())); currentDirectoryStrategy.addCustomProperties(additionalProperties); currentDirectoryStrategy.processSupportingFile(supportingFiles); } ServiceCombCodegen(); @Override CodegenType getTag(); @Override String getName(); @Override String getHelp(); @Override String modelFileFolder(); @Override String apiFileFolder(); @Override String apiFilename(String templateName, String tag); @Override Map<String, Object> postProcessOperationsWithModels(Map<String, Object> objs, List<Object> allModels); @Override void processOpts(); @Override void postProcessModelProperty(CodegenModel model, CodegenProperty property); @Override Map<String, Object> postProcessModelsEnum(Map<String, Object> objs); @Override String toApiName(String name); }
ServiceCombCodegen extends AbstractJavaCodegenExt { @Override public void processOpts() { super.processOpts(); importMapping.put("OffsetDateTime", "java.time.OffsetDateTime"); additionalProperties.put("dateLibrary", "java8"); additionalProperties.put("camelcase", new CamelCaseLambda()); additionalProperties.put("getGenericClassType", new GetGenericClassTypeLambda()); additionalProperties.put("getRelativeBasePath", new GetRelativeBasePathLambda()); additionalProperties.put("applicationId", applicationId); additionalProperties.put("library", getLibrary()); additionalProperties.put("outputFolder", outputFolder); additionalProperties.put("apiTemplateFiles", apiTemplateFiles); additionalProperties.put("apiTestTemplateFiles", apiTestTemplateFiles); additionalProperties.put("modelTemplateFiles", modelTemplateFiles); additionalProperties.put("apiDocTemplateFiles", apiDocTemplateFiles); if (additionalProperties.get(ProjectMetaConstant.SERVICE_ID) != null) { serviceId = (String) additionalProperties.get(ProjectMetaConstant.SERVICE_ID); } additionalProperties.put(ProjectMetaConstant.SERVICE_ID, serviceId); currentDirectoryStrategy = getStrategyMap() .get(Optional.ofNullable(additionalProperties.get(ProjectMetaConstant.SERVICE_TYPE)) .orElse(ServiceType.ALL.getValue())); currentDirectoryStrategy.addCustomProperties(additionalProperties); currentDirectoryStrategy.processSupportingFile(supportingFiles); } ServiceCombCodegen(); @Override CodegenType getTag(); @Override String getName(); @Override String getHelp(); @Override String modelFileFolder(); @Override String apiFileFolder(); @Override String apiFilename(String templateName, String tag); @Override Map<String, Object> postProcessOperationsWithModels(Map<String, Object> objs, List<Object> allModels); @Override void processOpts(); @Override void postProcessModelProperty(CodegenModel model, CodegenProperty property); @Override Map<String, Object> postProcessModelsEnum(Map<String, Object> objs); @Override String toApiName(String name); static final String DEFAULT_LIBRARY; static final String POJO_LIBRARY; static final String JAX_RS_LIBRARY; static final String SPRING_BOOT_LIBRARY; }