Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
I
ibizlab-generator
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
ibiz4jteam
ibizlab-generator
提交
59774755
提交
59774755
编写于
12月 13, 2021
作者:
sq3536
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
move
上级
a724efdb
变更
88
隐藏空白字符变更
内嵌
并排
正在显示
88 个修改的文件
包含
308 行增加
和
373 行删除
+308
-373
pom.xml
modules/ibizlab-generator-cli/pom.xml
+2
-2
Constants.java
...rator-cli/src/main/java/cn/ibizlab/codegen/Constants.java
+1
-1
IbizLabGenerator.java
...li/src/main/java/cn/ibizlab/codegen/IbizLabGenerator.java
+5
-6
BuildInfo.java
...r-cli/src/main/java/cn/ibizlab/codegen/cmd/BuildInfo.java
+6
-9
CompletionCommand.java
...c/main/java/cn/ibizlab/codegen/cmd/CompletionCommand.java
+1
-1
Generate.java
...or-cli/src/main/java/cn/ibizlab/codegen/cmd/Generate.java
+16
-18
GlobalOptions.java
...i/src/main/java/cn/ibizlab/codegen/cmd/GlobalOptions.java
+1
-1
HelpCommand.java
...cli/src/main/java/cn/ibizlab/codegen/cmd/HelpCommand.java
+1
-1
IbizLabGeneratorCommand.java
.../java/cn/ibizlab/codegen/cmd/IbizLabGeneratorCommand.java
+1
-1
Version.java
...tor-cli/src/main/java/cn/ibizlab/codegen/cmd/Version.java
+1
-1
package-info.java
...or-cli/src/main/java/cn/ibizlab/codegen/package-info.java
+1
-0
package-info.java
...r-cli/src/main/java/com/ibizlab/codegen/package-info.java
+0
-1
pom.xml
modules/ibizlab-generator-core/pom.xml
+1
-1
CodegenConfig.java
...-core/src/main/java/cn/ibizlab/codegen/CodegenConfig.java
+36
-8
CodegenConstants.java
...re/src/main/java/cn/ibizlab/codegen/CodegenConstants.java
+1
-1
DefaultGenerator.java
...re/src/main/java/cn/ibizlab/codegen/DefaultGenerator.java
+46
-36
Generator.java
...ator-core/src/main/java/cn/ibizlab/codegen/Generator.java
+2
-1
GeneratorNotFoundException.java
...n/java/cn/ibizlab/codegen/GeneratorNotFoundException.java
+1
-1
CodegenConfigurator.java
...n/java/cn/ibizlab/codegen/config/CodegenConfigurator.java
+21
-12
CodegenConfiguratorUtils.java
...a/cn/ibizlab/codegen/config/CodegenConfiguratorUtils.java
+2
-2
Context.java
...core/src/main/java/cn/ibizlab/codegen/config/Context.java
+3
-3
DynamicSettings.java
.../main/java/cn/ibizlab/codegen/config/DynamicSettings.java
+1
-1
GeneratorSettings.java
...ain/java/cn/ibizlab/codegen/config/GeneratorSettings.java
+1
-2
GlobalSettings.java
...c/main/java/cn/ibizlab/codegen/config/GlobalSettings.java
+1
-1
CodegenIgnoreProcessor.java
...ava/cn/ibizlab/codegen/ignore/CodegenIgnoreProcessor.java
+3
-6
DirectoryRule.java
...n/java/cn/ibizlab/codegen/ignore/rules/DirectoryRule.java
+1
-1
EverythingRule.java
.../java/cn/ibizlab/codegen/ignore/rules/EverythingRule.java
+1
-1
FileRule.java
...c/main/java/cn/ibizlab/codegen/ignore/rules/FileRule.java
+1
-1
IgnoreLineParser.java
...ava/cn/ibizlab/codegen/ignore/rules/IgnoreLineParser.java
+1
-1
InvalidRule.java
...ain/java/cn/ibizlab/codegen/ignore/rules/InvalidRule.java
+1
-1
ParserException.java
...java/cn/ibizlab/codegen/ignore/rules/ParserException.java
+1
-1
Part.java
...e/src/main/java/cn/ibizlab/codegen/ignore/rules/Part.java
+1
-1
RootedFileRule.java
.../java/cn/ibizlab/codegen/ignore/rules/RootedFileRule.java
+1
-1
Rule.java
...e/src/main/java/cn/ibizlab/codegen/ignore/rules/Rule.java
+1
-1
DstSystemModel.java
...src/main/java/cn/ibizlab/codegen/lite/DstSystemModel.java
+2
-2
DynamicModelStorage.java
...ain/java/cn/ibizlab/codegen/lite/DynamicModelStorage.java
+2
-2
EntityModel.java
...re/src/main/java/cn/ibizlab/codegen/lite/EntityModel.java
+2
-2
FieldModel.java
...ore/src/main/java/cn/ibizlab/codegen/lite/FieldModel.java
+2
-2
MetaDataSetModel.java
...c/main/java/cn/ibizlab/codegen/lite/MetaDataSetModel.java
+1
-1
MetaEntityModel.java
...rc/main/java/cn/ibizlab/codegen/lite/MetaEntityModel.java
+2
-2
MetaFieldModel.java
...src/main/java/cn/ibizlab/codegen/lite/MetaFieldModel.java
+2
-2
MetaLookupModel.java
...rc/main/java/cn/ibizlab/codegen/lite/MetaLookupModel.java
+1
-1
MetaRelationshipModel.java
...n/java/cn/ibizlab/codegen/lite/MetaRelationshipModel.java
+1
-1
RelationshipModel.java
.../main/java/cn/ibizlab/codegen/lite/RelationshipModel.java
+1
-1
Setting.java
...r-core/src/main/java/cn/ibizlab/codegen/lite/Setting.java
+2
-2
CliOption.java
...ore/src/main/java/cn/ibizlab/codegen/model/CliOption.java
+2
-7
DSLink.java
...r-core/src/main/java/cn/ibizlab/codegen/model/DSLink.java
+1
-1
DataObj.java
...-core/src/main/java/cn/ibizlab/codegen/model/DataObj.java
+2
-2
ModelStorage.java
.../src/main/java/cn/ibizlab/codegen/model/ModelStorage.java
+16
-19
POSchema.java
...core/src/main/java/cn/ibizlab/codegen/model/POSchema.java
+2
-2
PojoOption.java
...re/src/main/java/cn/ibizlab/codegen/model/PojoOption.java
+1
-1
PojoSchema.java
...re/src/main/java/cn/ibizlab/codegen/model/PojoSchema.java
+2
-3
TransUtils.java
...re/src/main/java/cn/ibizlab/codegen/model/TransUtils.java
+3
-2
package-info.java
...r-core/src/main/java/cn/ibizlab/codegen/package-info.java
+1
-0
CommonTemplateContentLocator.java
...zlab/codegen/templating/CommonTemplateContentLocator.java
+1
-1
GeneratorTemplateContentLocator.java
...b/codegen/templating/GeneratorTemplateContentLocator.java
+2
-2
MustacheEngineAdapter.java
.../cn/ibizlab/codegen/templating/MustacheEngineAdapter.java
+1
-1
TemplateDefinition.java
...ava/cn/ibizlab/codegen/templating/TemplateDefinition.java
+52
-0
TemplateFileType.java
.../java/cn/ibizlab/codegen/templating/TemplateFileType.java
+1
-1
TemplateManager.java
...n/java/cn/ibizlab/codegen/templating/TemplateManager.java
+1
-1
TemplateManagerOptions.java
...cn/ibizlab/codegen/templating/TemplateManagerOptions.java
+1
-1
TemplateNotFoundException.java
...ibizlab/codegen/templating/TemplateNotFoundException.java
+1
-1
TemplatePathLocator.java
...va/cn/ibizlab/codegen/templating/TemplatePathLocator.java
+1
-1
TemplateProcessor.java
...java/cn/ibizlab/codegen/templating/TemplateProcessor.java
+1
-1
TemplatingEngineAdapter.java
...n/ibizlab/codegen/templating/TemplatingEngineAdapter.java
+1
-1
TemplatingEngineLoader.java
...cn/ibizlab/codegen/templating/TemplatingEngineLoader.java
+1
-1
TemplatingExecutor.java
...ava/cn/ibizlab/codegen/templating/TemplatingExecutor.java
+1
-1
CamelCaseLambda.java
.../ibizlab/codegen/templating/mustache/CamelCaseLambda.java
+5
-4
CaseFormatLambda.java
...ibizlab/codegen/templating/mustache/CaseFormatLambda.java
+2
-2
IndentedLambda.java
...n/ibizlab/codegen/templating/mustache/IndentedLambda.java
+1
-1
JoinWithCommaLambda.java
...zlab/codegen/templating/mustache/JoinWithCommaLambda.java
+2
-2
LowercaseLambda.java
.../ibizlab/codegen/templating/mustache/LowercaseLambda.java
+2
-2
OnChangeLambda.java
...n/ibizlab/codegen/templating/mustache/OnChangeLambda.java
+1
-1
PrefixWithHashLambda.java
...lab/codegen/templating/mustache/PrefixWithHashLambda.java
+1
-1
SnakecaseLambda.java
.../ibizlab/codegen/templating/mustache/SnakecaseLambda.java
+3
-4
SplitStringLambda.java
...bizlab/codegen/templating/mustache/SplitStringLambda.java
+1
-1
TitlecaseLambda.java
.../ibizlab/codegen/templating/mustache/TitlecaseLambda.java
+1
-1
TrimWhitespaceLambda.java
...lab/codegen/templating/mustache/TrimWhitespaceLambda.java
+1
-1
UppercaseLambda.java
.../ibizlab/codegen/templating/mustache/UppercaseLambda.java
+1
-1
DataObject.java
...re/src/main/java/cn/ibizlab/codegen/utils/DataObject.java
+1
-1
ImplementationVersion.java
.../java/cn/ibizlab/codegen/utils/ImplementationVersion.java
+1
-1
Inflector.java
...ore/src/main/java/cn/ibizlab/codegen/utils/Inflector.java
+1
-1
Markdown.java
...core/src/main/java/cn/ibizlab/codegen/utils/Markdown.java
+1
-1
OptionUtils.java
...e/src/main/java/cn/ibizlab/codegen/utils/OptionUtils.java
+1
-1
StringAdvUtils.java
...rc/main/java/cn/ibizlab/codegen/utils/StringAdvUtils.java
+4
-4
CliOption.java
...tor-core/src/main/java/com/ibizlab/codegen/CliOption.java
+0
-147
package-info.java
...-core/src/main/java/com/ibizlab/codegen/package-info.java
+0
-1
pom.xml
pom.xml
+1
-1
未找到文件。
modules/ibizlab-generator-cli/pom.xml
浏览文件 @
59774755
...
...
@@ -4,7 +4,7 @@
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<parent>
<artifactId>
ibizlab-generator-project
</artifactId>
<groupId>
c
om
.ibizlab
</groupId>
<groupId>
c
n
.ibizlab
</groupId>
<version>
1.0-SNAPSHOT
</version>
<relativePath>
../../pom.xml
</relativePath>
</parent>
...
...
@@ -30,7 +30,7 @@
<configuration>
<archive>
<manifest>
<mainClass>
c
om
.ibizlab.codegen.IbizLabGenerator
</mainClass>
<mainClass>
c
n
.ibizlab.codegen.IbizLabGenerator
</mainClass>
</manifest>
</archive>
</configuration>
...
...
modules/ibizlab-generator-cli/src/main/java/c
om
/ibizlab/codegen/Constants.java
→
modules/ibizlab-generator-cli/src/main/java/c
n
/ibizlab/codegen/Constants.java
浏览文件 @
59774755
package
c
om
.
ibizlab
.
codegen
;
package
c
n
.
ibizlab
.
codegen
;
public
class
Constants
{
private
Constants
(){
}
...
...
modules/ibizlab-generator-cli/src/main/java/c
om
/ibizlab/codegen/IbizLabGenerator.java
→
modules/ibizlab-generator-cli/src/main/java/c
n
/ibizlab/codegen/IbizLabGenerator.java
浏览文件 @
59774755
...
...
@@ -15,18 +15,17 @@
* limitations under the License.
*/
package
c
om
.
ibizlab
.
codegen
;
package
c
n
.
ibizlab
.
codegen
;
import
cn.ibizlab.codegen.cmd.*
;
import
io.airlift.airline.Cli
;
import
io.airlift.airline.ParseArgumentsUnexpectedException
;
import
io.airlift.airline.ParseOptionMissingException
;
import
io.airlift.airline.ParseOptionMissingValueException
;
import
c
om
.ibizlab.codegen.cmd.*
;
import
c
n
.ibizlab.codegen.cmd.*
;
import
java.util.Locale
;
import
static
com
.
ibizlab
.
codegen
.
Constants
.
CLI_NAME
;
/**
* User: lanwen Date: 24.03.15 Time: 17:56
* <p>
...
...
@@ -37,7 +36,7 @@ public class IbizLabGenerator {
public
static
void
main
(
String
[]
args
)
{
BuildInfo
buildInfo
=
new
BuildInfo
();
Cli
.
CliBuilder
<
IbizLabGeneratorCommand
>
builder
=
Cli
.<
IbizLabGeneratorCommand
>
builder
(
CLI_NAME
)
Cli
.<
IbizLabGeneratorCommand
>
builder
(
C
onstants
.
C
LI_NAME
)
.
withDescription
(
String
.
format
(
Locale
.
ROOT
,
...
...
@@ -68,7 +67,7 @@ public class IbizLabGenerator {
System
.
exit
(
1
);
}
}
catch
(
ParseArgumentsUnexpectedException
e
)
{
System
.
err
.
printf
(
Locale
.
ROOT
,
"[error] %s%n%nSee '%s help' for usage.%n"
,
e
.
getMessage
(),
CLI_NAME
);
System
.
err
.
printf
(
Locale
.
ROOT
,
"[error] %s%n%nSee '%s help' for usage.%n"
,
e
.
getMessage
(),
C
onstants
.
C
LI_NAME
);
System
.
exit
(
1
);
}
catch
(
ParseOptionMissingException
|
ParseOptionMissingValueException
e
)
{
System
.
err
.
printf
(
Locale
.
ROOT
,
"[error] %s%n"
,
e
.
getMessage
());
...
...
modules/ibizlab-generator-cli/src/main/java/c
om
/ibizlab/codegen/cmd/BuildInfo.java
→
modules/ibizlab-generator-cli/src/main/java/c
n
/ibizlab/codegen/cmd/BuildInfo.java
浏览文件 @
59774755
package
com
.
ibizlab
.
codegen
.
cmd
;
package
cn
.
ibizlab
.
codegen
.
cmd
;
import
cn.ibizlab.codegen.Constants
;
import
java.io.IOException
;
import
java.io.InputStream
;
...
...
@@ -9,11 +11,6 @@ import java.time.format.DateTimeParseException;
import
java.util.Locale
;
import
java.util.Properties
;
import
static
com
.
ibizlab
.
codegen
.
Constants
.
CLI_NAME
;
import
static
com
.
ibizlab
.
codegen
.
Constants
.
GIT_REPO
;
import
static
com
.
ibizlab
.
codegen
.
Constants
.
SITE
;
/**
* Presents build-time information
*/
...
...
@@ -87,7 +84,7 @@ public class BuildInfo {
* @return Human-readable version display information
*/
public
String
versionDisplayText
()
{
StringBuilder
sb
=
new
StringBuilder
(
CLI_NAME
);
StringBuilder
sb
=
new
StringBuilder
(
C
onstants
.
C
LI_NAME
);
sb
.
append
(
" "
).
append
(
this
.
getVersion
()).
append
(
System
.
lineSeparator
());
sb
.
append
(
" commit : "
).
append
(
this
.
getSha
()).
append
(
System
.
lineSeparator
());
sb
.
append
(
" built : "
);
...
...
@@ -97,8 +94,8 @@ public class BuildInfo {
sb
.
append
(
UNKNOWN
);
}
sb
.
append
(
System
.
lineSeparator
());
sb
.
append
(
" source : "
).
append
(
GIT_REPO
).
append
(
System
.
lineSeparator
());
sb
.
append
(
" docs : "
).
append
(
SITE
).
append
(
System
.
lineSeparator
());
sb
.
append
(
" source : "
).
append
(
Constants
.
GIT_REPO
).
append
(
System
.
lineSeparator
());
sb
.
append
(
" docs : "
).
append
(
Constants
.
SITE
).
append
(
System
.
lineSeparator
());
return
sb
.
toString
();
}
}
modules/ibizlab-generator-cli/src/main/java/c
om
/ibizlab/codegen/cmd/CompletionCommand.java
→
modules/ibizlab-generator-cli/src/main/java/c
n
/ibizlab/codegen/cmd/CompletionCommand.java
浏览文件 @
59774755
...
...
@@ -19,7 +19,7 @@
* https://github.com/airlift/airline/blob/fc7a55e34b6361cb97235de5a1b21cba9b508f4b/src/main/java/io/airlift/airline/SuggestCommand.java#L1
* Modifications have been made to fit the needs of OpenAPI Tools CLI.
*/
package
c
om
.
ibizlab
.
codegen
.
cmd
;
package
c
n
.
ibizlab
.
codegen
.
cmd
;
import
com.google.common.annotations.VisibleForTesting
;
import
com.google.common.base.Joiner
;
...
...
modules/ibizlab-generator-cli/src/main/java/c
om
/ibizlab/codegen/cmd/Generate.java
→
modules/ibizlab-generator-cli/src/main/java/c
n
/ibizlab/codegen/cmd/Generate.java
浏览文件 @
59774755
...
...
@@ -15,26 +15,23 @@
* limitations under the License.
*/
package
com
.
ibizlab
.
codegen
.
cmd
;
import
ch.qos.logback.classic.LoggerContext
;
import
ch.qos.logback.core.spi.FilterAttachable
;
import
com.ibizlab.codegen.*
;
import
com.ibizlab.codegen.config.CodegenConfigurator
;
import
com.ibizlab.codegen.config.CodegenConfiguratorUtils
;
package
cn
.
ibizlab
.
codegen
.
cmd
;
import
cn.ibizlab.codegen.CodegenConstants
;
import
cn.ibizlab.codegen.DefaultGenerator
;
import
cn.ibizlab.codegen.Generator
;
import
cn.ibizlab.codegen.GeneratorNotFoundException
;
import
cn.ibizlab.codegen.config.CodegenConfigurator
;
import
cn.ibizlab.codegen.config.CodegenConfiguratorUtils
;
import
cn.ibizlab.codegen.*
;
import
io.airlift.airline.Command
;
import
io.airlift.airline.Option
;
import
org.apache.commons.lang3.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
java.io.File
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.stream.Stream
;
import
static
com
.
ibizlab
.
codegen
.
config
.
CodegenConfiguratorUtils
.
applyAdditionalPropertiesKvpList
;
import
static
com
.
ibizlab
.
codegen
.
config
.
CodegenConfiguratorUtils
.
applyGlobalPropertiesKvpList
;
import
static
org
.
apache
.
commons
.
lang3
.
StringUtils
.
isNotEmpty
;
@SuppressWarnings
({
"java:S106"
})
...
...
@@ -132,11 +129,12 @@ public class Generate extends IbizLabGeneratorCommand {
if
(
configFile
!=
null
&&
configFile
.
length
()
>
0
)
{
// attempt to load from configFile
configurator
=
CodegenConfigurator
.
fromFile
(
configFile
);
}
else
if
(
StringUtils
.
isEmpty
(
spec
))
{
// if user doesn't pass configFile and does not pass spec, we can fail immediately because one of these two is required to run.
System
.
err
.
println
(
"[error] Required option '-i' is missing"
);
System
.
exit
(
1
);
}
// else if (StringUtils.isEmpty(spec)) {
// // if user doesn't pass configFile and does not pass spec, we can fail immediately because one of these two is required to run.
// System.err.println("[error] Required option '-i' is missing");
// System.exit(1);
// }
// if a config file wasn't specified, or we were unable to read it
if
(
configurator
==
null
)
{
...
...
@@ -202,10 +200,10 @@ public class Generate extends IbizLabGeneratorCommand {
if
(
globalProperties
!=
null
&&
!
globalProperties
.
isEmpty
())
{
applyGlobalPropertiesKvpList
(
globalProperties
,
configurator
);
CodegenConfiguratorUtils
.
applyGlobalPropertiesKvpList
(
globalProperties
,
configurator
);
}
applyAdditionalPropertiesKvpList
(
additionalProperties
,
configurator
);
CodegenConfiguratorUtils
.
applyAdditionalPropertiesKvpList
(
additionalProperties
,
configurator
);
try
{
...
...
modules/ibizlab-generator-cli/src/main/java/c
om
/ibizlab/codegen/cmd/GlobalOptions.java
→
modules/ibizlab-generator-cli/src/main/java/c
n
/ibizlab/codegen/cmd/GlobalOptions.java
浏览文件 @
59774755
package
c
om
.
ibizlab
.
codegen
.
cmd
;
package
c
n
.
ibizlab
.
codegen
.
cmd
;
import
io.airlift.airline.Option
;
...
...
modules/ibizlab-generator-cli/src/main/java/c
om
/ibizlab/codegen/cmd/HelpCommand.java
→
modules/ibizlab-generator-cli/src/main/java/c
n
/ibizlab/codegen/cmd/HelpCommand.java
浏览文件 @
59774755
package
c
om
.
ibizlab
.
codegen
.
cmd
;
package
c
n
.
ibizlab
.
codegen
.
cmd
;
import
io.airlift.airline.Command
;
import
io.airlift.airline.Help
;
...
...
modules/ibizlab-generator-cli/src/main/java/c
om
/ibizlab/codegen/cmd/IbizLabGeneratorCommand.java
→
modules/ibizlab-generator-cli/src/main/java/c
n
/ibizlab/codegen/cmd/IbizLabGeneratorCommand.java
浏览文件 @
59774755
package
c
om
.
ibizlab
.
codegen
.
cmd
;
package
c
n
.
ibizlab
.
codegen
.
cmd
;
import
io.airlift.airline.Help
;
import
io.airlift.airline.model.GlobalMetadata
;
...
...
modules/ibizlab-generator-cli/src/main/java/c
om
/ibizlab/codegen/cmd/Version.java
→
modules/ibizlab-generator-cli/src/main/java/c
n
/ibizlab/codegen/cmd/Version.java
浏览文件 @
59774755
...
...
@@ -15,7 +15,7 @@
* limitations under the License.
*/
package
c
om
.
ibizlab
.
codegen
.
cmd
;
package
c
n
.
ibizlab
.
codegen
.
cmd
;
import
io.airlift.airline.Command
;
import
io.airlift.airline.Option
;
...
...
modules/ibizlab-generator-cli/src/main/java/cn/ibizlab/codegen/package-info.java
0 → 100644
浏览文件 @
59774755
package
cn
.
ibizlab
.
codegen
;
\ No newline at end of file
modules/ibizlab-generator-cli/src/main/java/com/ibizlab/codegen/package-info.java
已删除
100644 → 0
浏览文件 @
a724efdb
package
com
.
ibizlab
.
codegen
;
\ No newline at end of file
modules/ibizlab-generator-core/pom.xml
浏览文件 @
59774755
...
...
@@ -5,7 +5,7 @@
<parent>
<artifactId>
ibizlab-generator-project
</artifactId>
<groupId>
c
om
.ibizlab
</groupId>
<groupId>
c
n
.ibizlab
</groupId>
<version>
1.0-SNAPSHOT
</version>
<relativePath>
../../pom.xml
</relativePath>
</parent>
...
...
modules/ibizlab-generator-core/src/main/java/c
om
/ibizlab/codegen/CodegenConfig.java
→
modules/ibizlab-generator-core/src/main/java/c
n
/ibizlab/codegen/CodegenConfig.java
浏览文件 @
59774755
...
...
@@ -15,24 +15,28 @@
* limitations under the License.
*/
package
c
om
.
ibizlab
.
codegen
;
package
c
n
.
ibizlab
.
codegen
;
import
cn.ibizlab.codegen.config.GlobalSettings
;
import
cn.ibizlab.codegen.templating.TemplateDefinition
;
import
cn.ibizlab.codegen.templating.TemplatingEngineAdapter
;
import
cn.ibizlab.codegen.utils.StringAdvUtils
;
import
com.github.benmanes.caffeine.cache.Cache
;
import
com.github.benmanes.caffeine.cache.Caffeine
;
import
com.github.benmanes.caffeine.cache.Ticker
;
import
com.ibizlab.codegen.templating.TemplatingEngineAdapter
;
import
com.ibizlab.codegen.config.GlobalSettings
;
import
lombok.Getter
;
import
lombok.NoArgsConstructor
;
import
lombok.Setter
;
import
lombok.experimental.Accessors
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.util.StringUtils
;
import
java.io.File
;
import
java.nio.file.Paths
;
import
java.util.*
;
import
java.util.concurrent.TimeUnit
;
import
static
com
.
ibizlab
.
codegen
.
utils
.
StringAdvUtils
.*;
import
java.util.regex.Pattern
;
@Getter
@Setter
...
...
@@ -68,6 +72,30 @@ public class CodegenConfig {
return
additionalProperties
.
getOrDefault
(
CodegenConstants
.
IGNORE_FILE_OVERRIDE
,
""
).
toString
();
}
private
List
<
TemplateDefinition
>
templateDefinitions
;
public
List
<
TemplateDefinition
>
getTemplateDefinitions
()
{
if
(
templateDefinitions
==
null
&&
(!
StringUtils
.
isEmpty
(
templateDir
)))
{
templateDefinitions
=
new
ArrayList
<>();
scanTemplate
(
new
File
(
templateDir
),
templateDefinitions
);
}
return
templateDefinitions
;
}
private
void
scanTemplate
(
File
file
,
List
<
TemplateDefinition
>
templateDefinitions
)
{
if
(
file
.
isDirectory
())
{
for
(
File
sub:
file
.
listFiles
())
scanTemplate
(
sub
,
templateDefinitions
);
}
else
{
templateDefinitions
.
add
(
new
TemplateDefinition
(
Paths
.
get
(
"/"
,
file
.
getPath
().
replace
(
this
.
getTemplateDir
(),
""
)).
toString
()));
}
}
@SuppressWarnings
(
"static-method"
)
public
String
sanitizeName
(
String
name
)
{
return
sanitizeName
(
name
,
"\\W"
);
...
...
@@ -78,8 +106,8 @@ public class CodegenConfig {
static
{
int
cacheSize
=
Integer
.
parseInt
(
GlobalSettings
.
getProperty
(
NAME_CACHE_SIZE_PROPERTY
,
"500"
));
int
cacheExpiry
=
Integer
.
parseInt
(
GlobalSettings
.
getProperty
(
NAME_CACHE_EXPIRY_PROPERTY
,
"10"
));
int
cacheSize
=
Integer
.
parseInt
(
GlobalSettings
.
getProperty
(
StringAdvUtils
.
NAME_CACHE_SIZE_PROPERTY
,
"500"
));
int
cacheExpiry
=
Integer
.
parseInt
(
GlobalSettings
.
getProperty
(
StringAdvUtils
.
NAME_CACHE_EXPIRY_PROPERTY
,
"10"
));
sanitizedNameCache
=
Caffeine
.
newBuilder
()
.
maximumSize
(
cacheSize
)
.
expireAfterAccess
(
cacheExpiry
,
TimeUnit
.
SECONDS
)
...
...
@@ -177,7 +205,7 @@ public class CodegenConfig {
* @return Sanitized tag
*/
public
String
sanitizeTag
(
String
tag
)
{
tag
=
camelize
(
sanitizeName
(
tag
));
tag
=
StringAdvUtils
.
camelize
(
sanitizeName
(
tag
));
// tag starts with numbers
if
(
tag
.
matches
(
"^\\d.*"
))
{
...
...
modules/ibizlab-generator-core/src/main/java/c
om
/ibizlab/codegen/CodegenConstants.java
→
modules/ibizlab-generator-core/src/main/java/c
n
/ibizlab/codegen/CodegenConstants.java
浏览文件 @
59774755
...
...
@@ -15,7 +15,7 @@
* limitations under the License.
*/
package
c
om
.
ibizlab
.
codegen
;
package
c
n
.
ibizlab
.
codegen
;
/**
* A class for storing constants that are used throughout the project.
...
...
modules/ibizlab-generator-core/src/main/java/c
om
/ibizlab/codegen/DefaultGenerator.java
→
modules/ibizlab-generator-core/src/main/java/c
n
/ibizlab/codegen/DefaultGenerator.java
浏览文件 @
59774755
...
...
@@ -15,18 +15,24 @@
* limitations under the License.
*/
package
com
.
ibizlab
.
codegen
;
import
com.ibizlab.codegen.templating.TemplatePathLocator
;
import
com.ibizlab.codegen.templating.TemplateProcessor
;
import
com.ibizlab.codegen.templating.TemplatingEngineAdapter
;
import
com.ibizlab.codegen.ignore.CodegenIgnoreProcessor
;
import
com.ibizlab.codegen.lite.DynamicModelStorage
;
import
com.ibizlab.codegen.templating.*
;
package
cn
.
ibizlab
.
codegen
;
import
cn.ibizlab.codegen.ignore.CodegenIgnoreProcessor
;
import
cn.ibizlab.codegen.lite.DynamicModelStorage
;
import
cn.ibizlab.codegen.model.CliOption
;
import
cn.ibizlab.codegen.model.ModelStorage
;
import
cn.ibizlab.codegen.templating.*
;
import
cn.ibizlab.codegen.templating.TemplatePathLocator
;
import
cn.ibizlab.codegen.templating.TemplateProcessor
;
import
cn.ibizlab.codegen.templating.TemplatingEngineAdapter
;
import
cn.ibizlab.codegen.templating.*
;
import
com.github.mustachejava.DefaultMustacheFactory
;
import
com.github.mustachejava.Mustache
;
import
lombok.extern.slf4j.Slf4j
;
import
java.io.*
;
import
java.nio.file.Path
;
import
java.nio.file.Paths
;
import
java.util.*
;
@Slf4j
...
...
@@ -44,6 +50,9 @@ public class DefaultGenerator implements Generator {
private
CodegenIgnoreProcessor
ignoreProcessor
;
protected
ModelStorage
modelStorage
;
protected
DynamicModelStorage
dynamicModelStorage
;
@SuppressWarnings
(
"deprecation"
)
...
...
@@ -51,7 +60,8 @@ public class DefaultGenerator implements Generator {
public
Generator
opts
(
CodegenConfig
opts
)
{
this
.
config
=
opts
;
DynamicModelStorage
.
getInstance
().
modelPath
(
this
.
config
.
getInputSpec
());
dynamicModelStorage
=
DynamicModelStorage
.
getInstance
().
modelPath
(
this
.
config
.
getInputSpec
());
modelStorage
=
ModelStorage
.
getInstance
().
config
(
config
);
TemplateManagerOptions
templateManagerOptions
=
new
TemplateManagerOptions
(
this
.
config
.
isEnableMinimalUpdate
(),
this
.
config
.
isSkipOverwrite
());
...
...
@@ -92,6 +102,19 @@ public class DefaultGenerator implements Generator {
@Override
public
List
<
File
>
generate
()
{
for
(
TemplateDefinition
templateDefinition:
this
.
config
.
getTemplateDefinitions
())
{
for
(
CliOption
opt:
templateDefinition
.
getTemplateDatas
())
{
try
{
processTemplateToFile
(
opt
,
templateDefinition
.
getTemplateFile
());
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
}
return
null
;
}
...
...
@@ -124,35 +147,22 @@ public class DefaultGenerator implements Generator {
return
defaultValue
;
}
private
DefaultMustacheFactory
mf
=
new
DefaultMustacheFactory
();
protected
File
processTemplateToFile
(
Map
<
String
,
Object
>
templateData
,
String
templateName
)
throws
IOException
{
// private void generateModel(List<File> files, Map<String, Object> models, String modelName) throws IOException {
// for (String templateName : config.modelTemplateFiles().keySet()) {
// String filename = config.modelFilename(templateName, modelName);
// File written = processTemplateToFile(models, templateName, filename, generateModels, CodegenConstants.MODELS);
// if (written != null) {
// files.add(written);
// if (config.isEnablePostProcessFile() && !dryRun) {
// config.postProcessFile(written, "model");
// }
// }
// }
// }
protected
File
processTemplateToFile
(
Map
<
String
,
Object
>
templateData
,
String
templateName
,
String
outputFilename
,
boolean
shouldGenerate
,
String
skippedByOption
)
throws
IOException
{
String
adjustedOutputFilename
=
outputFilename
.
replaceAll
(
"//"
,
"/"
).
replace
(
'/'
,
File
.
separatorChar
);
File
target
=
new
File
(
adjustedOutputFilename
);
StringWriter
writer
=
new
StringWriter
();
Mustache
mustache
=
mf
.
compile
(
new
StringReader
(
templateName
),
"outputFilename"
);
mustache
.
execute
(
writer
,
templateData
);
String
outputFilename
=
writer
.
toString
();
File
target
=
Paths
.
get
(
this
.
config
.
getOutputDir
(),
outputFilename
).
toFile
();
if
(
ignoreProcessor
.
allowsFile
(
target
))
{
if
(
shouldGenerate
)
{
Path
outDir
=
java
.
nio
.
file
.
Paths
.
get
(
this
.
config
.
getOutputDir
()).
toAbsolutePath
();
Path
absoluteTarget
=
target
.
toPath
().
toAbsolutePath
();
if
(!
absoluteTarget
.
startsWith
(
outDir
))
{
throw
new
RuntimeException
(
String
.
format
(
Locale
.
ROOT
,
"Target files must be generated within the output directory; absoluteTarget=%s outDir=%s"
,
absoluteTarget
,
outDir
));
}
return
this
.
templateProcessor
.
write
(
templateData
,
templateName
,
target
);
}
else
{
this
.
templateProcessor
.
skip
(
target
.
toPath
(),
String
.
format
(
Locale
.
ROOT
,
"Skipped by %s options supplied by user."
,
skippedByOption
));
return
null
;
}
return
this
.
templateProcessor
.
write
(
templateData
,
templateName
,
target
);
}
else
{
this
.
templateProcessor
.
ignore
(
target
.
toPath
(),
"Ignored by rule in ignore file."
);
return
null
;
...
...
modules/ibizlab-generator-core/src/main/java/c
om
/ibizlab/codegen/Generator.java
→
modules/ibizlab-generator-core/src/main/java/c
n
/ibizlab/codegen/Generator.java
浏览文件 @
59774755
package
c
om
.
ibizlab
.
codegen
;
package
c
n
.
ibizlab
.
codegen
;
import
java.io.File
;
import
java.io.IOException
;
import
java.util.List
;
public
interface
Generator
{
...
...
modules/ibizlab-generator-core/src/main/java/c
om
/ibizlab/codegen/GeneratorNotFoundException.java
→
modules/ibizlab-generator-core/src/main/java/c
n
/ibizlab/codegen/GeneratorNotFoundException.java
浏览文件 @
59774755
package
c
om
.
ibizlab
.
codegen
;
package
c
n
.
ibizlab
.
codegen
;
/**
* Typed exception exposing issues with loading generators (e.g. by name).
...
...
modules/ibizlab-generator-core/src/main/java/c
om
/ibizlab/codegen/config/CodegenConfigurator.java
→
modules/ibizlab-generator-core/src/main/java/c
n
/ibizlab/codegen/config/CodegenConfigurator.java
浏览文件 @
59774755
...
...
@@ -15,14 +15,17 @@
* limitations under the License.
*/
package
c
om
.
ibizlab
.
codegen
.
config
;
package
c
n
.
ibizlab
.
codegen
.
config
;
import
cn.ibizlab.codegen.CodegenConfig
;
import
cn.ibizlab.codegen.CodegenConstants
;
import
cn.ibizlab.codegen.templating.MustacheEngineAdapter
;
import
com.fasterxml.jackson.databind.Module
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.fasterxml.jackson.datatype.guava.GuavaModule
;
import
c
om
.ibizlab.codegen.*
;
import
c
om
.ibizlab.codegen.templating.TemplatingEngineAdapter
;
import
c
om
.ibizlab.codegen.templating.TemplatingEngineLoader
;
import
c
n
.ibizlab.codegen.*
;
import
c
n
.ibizlab.codegen.templating.TemplatingEngineAdapter
;
import
c
n
.ibizlab.codegen.templating.TemplatingEngineLoader
;
import
io.swagger.v3.core.util.Json
;
import
io.swagger.v3.core.util.Yaml
;
import
org.apache.commons.io.FilenameUtils
;
...
...
@@ -239,16 +242,22 @@ public final class CodegenConfigurator {
TemplatingEngineAdapter
templatingEngine
=
TemplatingEngineLoader
.
byIdentifier
(
this
.
templatingEngineName
);
TemplatingEngineAdapter
templatingEngine
=
new
MustacheEngineAdapter
(
);
config
.
setTemplatingEngine
(
templatingEngine
);
config
.
getAdditionalProperties
().
putAll
(
this
.
additionalProperties
);
config
.
getAdditionalProperties
().
putAll
(
this
.
globalProperties
);
config
.
setInputSpec
(
this
.
inputSpec
);
config
.
setOutputDir
(
this
.
outputDir
);
config
.
setTemplateDir
(
this
.
templateDir
);
config
.
setAuth
(
this
.
auth
);
if
(
this
.
additionalProperties
!=
null
)
config
.
getAdditionalProperties
().
putAll
(
this
.
additionalProperties
);
if
(
this
.
globalProperties
!=
null
)
config
.
getAdditionalProperties
().
putAll
(
this
.
globalProperties
);
if
(!
StringUtils
.
isEmpty
(
this
.
inputSpec
))
config
.
setInputSpec
(
this
.
inputSpec
);
if
(!
StringUtils
.
isEmpty
(
this
.
outputDir
))
config
.
setOutputDir
(
this
.
outputDir
);
if
(!
StringUtils
.
isEmpty
(
this
.
templateDir
))
config
.
setTemplateDir
(
this
.
templateDir
);
if
(!
StringUtils
.
isEmpty
(
this
.
auth
))
config
.
setAuth
(
this
.
auth
);
return
config
;
}
...
...
modules/ibizlab-generator-core/src/main/java/c
om
/ibizlab/codegen/config/CodegenConfiguratorUtils.java
→
modules/ibizlab-generator-core/src/main/java/c
n
/ibizlab/codegen/config/CodegenConfiguratorUtils.java
浏览文件 @
59774755
...
...
@@ -15,9 +15,9 @@
* limitations under the License.
*/
package
c
om
.
ibizlab
.
codegen
.
config
;
package
c
n
.
ibizlab
.
codegen
.
config
;
import
c
om
.ibizlab.codegen.utils.OptionUtils
;
import
c
n
.ibizlab.codegen.utils.OptionUtils
;
import
org.apache.commons.lang3.tuple.Pair
;
import
java.util.*
;
...
...
modules/ibizlab-generator-core/src/main/java/c
om
/ibizlab/codegen/config/Context.java
→
modules/ibizlab-generator-core/src/main/java/c
n
/ibizlab/codegen/config/Context.java
浏览文件 @
59774755
...
...
@@ -14,13 +14,13 @@
* limitations under the License.
*/
package
c
om
.
ibizlab
.
codegen
.
config
;
package
c
n
.
ibizlab
.
codegen
.
config
;
import
cn.ibizlab.codegen.model.PojoOption
;
import
cn.ibizlab.codegen.templating.TemplateFileType
;
import
com.github.mustachejava.DefaultMustacheFactory
;
import
com.github.mustachejava.Mustache
;
import
com.github.mustachejava.reflect.ReflectionObjectHandler
;
import
com.ibizlab.codegen.templating.TemplateFileType
;
import
com.ibizlab.codegen.model.PojoOption
;
import
lombok.Getter
;
import
lombok.NoArgsConstructor
;
import
lombok.Setter
;
...
...
modules/ibizlab-generator-core/src/main/java/c
om
/ibizlab/codegen/config/DynamicSettings.java
→
modules/ibizlab-generator-core/src/main/java/c
n
/ibizlab/codegen/config/DynamicSettings.java
浏览文件 @
59774755
package
c
om
.
ibizlab
.
codegen
.
config
;
package
c
n
.
ibizlab
.
codegen
.
config
;
import
com.fasterxml.jackson.annotation.JsonAnySetter
;
import
com.fasterxml.jackson.annotation.JsonCreator
;
...
...
modules/ibizlab-generator-core/src/main/java/c
om
/ibizlab/codegen/config/GeneratorSettings.java
→
modules/ibizlab-generator-core/src/main/java/c
n
/ibizlab/codegen/config/GeneratorSettings.java
浏览文件 @
59774755
package
c
om
.
ibizlab
.
codegen
.
config
;
package
c
n
.
ibizlab
.
codegen
.
config
;
import
lombok.Builder
;
import
lombok.Getter
;
import
lombok.NoArgsConstructor
;
import
lombok.Setter
;
...
...
modules/ibizlab-generator-core/src/main/java/c
om
/ibizlab/codegen/config/GlobalSettings.java
→
modules/ibizlab-generator-core/src/main/java/c
n
/ibizlab/codegen/config/GlobalSettings.java
浏览文件 @
59774755
package
c
om
.
ibizlab
.
codegen
.
config
;
package
c
n
.
ibizlab
.
codegen
.
config
;
import
java.util.Properties
;
...
...
modules/ibizlab-generator-core/src/main/java/c
om
/ibizlab/codegen/ignore/CodegenIgnoreProcessor.java
→
modules/ibizlab-generator-core/src/main/java/c
n
/ibizlab/codegen/ignore/CodegenIgnoreProcessor.java
浏览文件 @
59774755
...
...
@@ -15,23 +15,20 @@
* limitations under the License.
*/
package
c
om
.
ibizlab
.
codegen
.
ignore
;
package
c
n
.
ibizlab
.
codegen
.
ignore
;
import
c
om
.ibizlab.codegen.ignore.rules.DirectoryRule
;
import
c
om
.ibizlab.codegen.ignore.rules.Rule
;
import
c
n
.ibizlab.codegen.ignore.rules.DirectoryRule
;
import
c
n
.ibizlab.codegen.ignore.rules.Rule
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
java.io.*
;
import
java.nio.charset.StandardCharsets
;
import
java.nio.file.Files
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.List
;
import
java.util.Locale
;
import
static
java
.
nio
.
file
.
StandardCopyOption
.
REPLACE_EXISTING
;
/**
* Presents a processing utility for parsing and evaluating files containing common ignore patterns. (.openapi-generator-ignore)
*/
...
...
modules/ibizlab-generator-core/src/main/java/c
om
/ibizlab/codegen/ignore/rules/DirectoryRule.java
→
modules/ibizlab-generator-core/src/main/java/c
n
/ibizlab/codegen/ignore/rules/DirectoryRule.java
浏览文件 @
59774755
...
...
@@ -15,7 +15,7 @@
* limitations under the License.
*/
package
c
om
.
ibizlab
.
codegen
.
ignore
.
rules
;
package
c
n
.
ibizlab
.
codegen
.
ignore
.
rules
;
import
java.nio.file.FileSystems
;
import
java.nio.file.PathMatcher
;
...
...
modules/ibizlab-generator-core/src/main/java/c
om
/ibizlab/codegen/ignore/rules/EverythingRule.java
→
modules/ibizlab-generator-core/src/main/java/c
n
/ibizlab/codegen/ignore/rules/EverythingRule.java
浏览文件 @
59774755
...
...
@@ -15,7 +15,7 @@
* limitations under the License.
*/
package
c
om
.
ibizlab
.
codegen
.
ignore
.
rules
;
package
c
n
.
ibizlab
.
codegen
.
ignore
.
rules
;
import
java.util.List
;
...
...
modules/ibizlab-generator-core/src/main/java/c
om
/ibizlab/codegen/ignore/rules/FileRule.java
→
modules/ibizlab-generator-core/src/main/java/c
n
/ibizlab/codegen/ignore/rules/FileRule.java
浏览文件 @
59774755
...
...
@@ -15,7 +15,7 @@
* limitations under the License.
*/
package
c
om
.
ibizlab
.
codegen
.
ignore
.
rules
;
package
c
n
.
ibizlab
.
codegen
.
ignore
.
rules
;
import
java.nio.file.FileSystems
;
import
java.nio.file.PathMatcher
;
...
...
modules/ibizlab-generator-core/src/main/java/c
om
/ibizlab/codegen/ignore/rules/IgnoreLineParser.java
→
modules/ibizlab-generator-core/src/main/java/c
n
/ibizlab/codegen/ignore/rules/IgnoreLineParser.java
浏览文件 @
59774755
...
...
@@ -15,7 +15,7 @@
* limitations under the License.
*/
package
c
om
.
ibizlab
.
codegen
.
ignore
.
rules
;
package
c
n
.
ibizlab
.
codegen
.
ignore
.
rules
;
import
java.util.ArrayList
;
import
java.util.List
;
...
...
modules/ibizlab-generator-core/src/main/java/c
om
/ibizlab/codegen/ignore/rules/InvalidRule.java
→
modules/ibizlab-generator-core/src/main/java/c
n
/ibizlab/codegen/ignore/rules/InvalidRule.java
浏览文件 @
59774755
...
...
@@ -15,7 +15,7 @@
* limitations under the License.
*/
package
c
om
.
ibizlab
.
codegen
.
ignore
.
rules
;
package
c
n
.
ibizlab
.
codegen
.
ignore
.
rules
;
import
java.util.List
;
...
...
modules/ibizlab-generator-core/src/main/java/c
om
/ibizlab/codegen/ignore/rules/ParserException.java
→
modules/ibizlab-generator-core/src/main/java/c
n
/ibizlab/codegen/ignore/rules/ParserException.java
浏览文件 @
59774755
...
...
@@ -15,7 +15,7 @@
* limitations under the License.
*/
package
c
om
.
ibizlab
.
codegen
.
ignore
.
rules
;
package
c
n
.
ibizlab
.
codegen
.
ignore
.
rules
;
public
class
ParserException
extends
Exception
{
/**
...
...
modules/ibizlab-generator-core/src/main/java/c
om
/ibizlab/codegen/ignore/rules/Part.java
→
modules/ibizlab-generator-core/src/main/java/c
n
/ibizlab/codegen/ignore/rules/Part.java
浏览文件 @
59774755
...
...
@@ -15,7 +15,7 @@
* limitations under the License.
*/
package
c
om
.
ibizlab
.
codegen
.
ignore
.
rules
;
package
c
n
.
ibizlab
.
codegen
.
ignore
.
rules
;
class
Part
{
private
final
IgnoreLineParser
.
Token
token
;
...
...
modules/ibizlab-generator-core/src/main/java/c
om
/ibizlab/codegen/ignore/rules/RootedFileRule.java
→
modules/ibizlab-generator-core/src/main/java/c
n
/ibizlab/codegen/ignore/rules/RootedFileRule.java
浏览文件 @
59774755
...
...
@@ -15,7 +15,7 @@
* limitations under the License.
*/
package
c
om
.
ibizlab
.
codegen
.
ignore
.
rules
;
package
c
n
.
ibizlab
.
codegen
.
ignore
.
rules
;
import
java.util.List
;
import
java.util.regex.Pattern
;
...
...
modules/ibizlab-generator-core/src/main/java/c
om
/ibizlab/codegen/ignore/rules/Rule.java
→
modules/ibizlab-generator-core/src/main/java/c
n
/ibizlab/codegen/ignore/rules/Rule.java
浏览文件 @
59774755
...
...
@@ -15,7 +15,7 @@
* limitations under the License.
*/
package
c
om
.
ibizlab
.
codegen
.
ignore
.
rules
;
package
c
n
.
ibizlab
.
codegen
.
ignore
.
rules
;
import
java.util.List
;
...
...
modules/ibizlab-generator-core/src/main/java/c
om
/ibizlab/codegen/lite/DstSystemModel.java
→
modules/ibizlab-generator-core/src/main/java/c
n
/ibizlab/codegen/lite/DstSystemModel.java
浏览文件 @
59774755
package
c
om
.
ibizlab
.
codegen
.
lite
;
package
c
n
.
ibizlab
.
codegen
.
lite
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONArray
;
...
...
@@ -8,7 +8,7 @@ import com.fasterxml.jackson.annotation.JsonIgnore;
import
com.fasterxml.jackson.annotation.JsonIgnoreProperties
;
import
com.fasterxml.jackson.annotation.JsonInclude
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
c
om
.ibizlab.codegen.utils.DataObject
;
import
c
n
.ibizlab.codegen.utils.DataObject
;
import
lombok.Getter
;
import
lombok.NoArgsConstructor
;
import
lombok.Setter
;
...
...
modules/ibizlab-generator-core/src/main/java/c
om
/ibizlab/codegen/lite/DynamicModelStorage.java
→
modules/ibizlab-generator-core/src/main/java/c
n
/ibizlab/codegen/lite/DynamicModelStorage.java
浏览文件 @
59774755
package
c
om
.
ibizlab
.
codegen
.
lite
;
package
c
n
.
ibizlab
.
codegen
.
lite
;
import
com.alibaba.fastjson.JSON
;
import
c
om
.ibizlab.codegen.utils.Inflector
;
import
c
n
.ibizlab.codegen.utils.Inflector
;
import
net.ibizsys.model.IPSSystem
;
import
net.ibizsys.model.PSModelServiceImpl
;
import
net.ibizsys.model.database.IPSDEFDTColumn
;
...
...
modules/ibizlab-generator-core/src/main/java/c
om
/ibizlab/codegen/lite/EntityModel.java
→
modules/ibizlab-generator-core/src/main/java/c
n
/ibizlab/codegen/lite/EntityModel.java
浏览文件 @
59774755
package
c
om
.
ibizlab
.
codegen
.
lite
;
package
c
n
.
ibizlab
.
codegen
.
lite
;
import
com.alibaba.fastjson.annotation.JSONField
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
import
com.fasterxml.jackson.annotation.JsonIgnoreProperties
;
import
c
om
.ibizlab.codegen.utils.DataObject
;
import
c
n
.ibizlab.codegen.utils.DataObject
;
import
lombok.Getter
;
import
lombok.NoArgsConstructor
;
import
lombok.Setter
;
...
...
modules/ibizlab-generator-core/src/main/java/c
om
/ibizlab/codegen/lite/FieldModel.java
→
modules/ibizlab-generator-core/src/main/java/c
n
/ibizlab/codegen/lite/FieldModel.java
浏览文件 @
59774755
package
c
om
.
ibizlab
.
codegen
.
lite
;
package
c
n
.
ibizlab
.
codegen
.
lite
;
import
com.alibaba.fastjson.annotation.JSONField
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
import
com.fasterxml.jackson.annotation.JsonIgnoreProperties
;
import
c
om
.ibizlab.codegen.utils.DataObject
;
import
c
n
.ibizlab.codegen.utils.DataObject
;
import
lombok.Getter
;
import
lombok.NoArgsConstructor
;
import
lombok.Setter
;
...
...
modules/ibizlab-generator-core/src/main/java/c
om
/ibizlab/codegen/lite/MetaDataSetModel.java
→
modules/ibizlab-generator-core/src/main/java/c
n
/ibizlab/codegen/lite/MetaDataSetModel.java
浏览文件 @
59774755
package
c
om
.
ibizlab
.
codegen
.
lite
;
package
c
n
.
ibizlab
.
codegen
.
lite
;
import
com.alibaba.fastjson.annotation.JSONField
;
import
com.fasterxml.jackson.annotation.JsonIgnoreProperties
;
...
...
modules/ibizlab-generator-core/src/main/java/c
om
/ibizlab/codegen/lite/MetaEntityModel.java
→
modules/ibizlab-generator-core/src/main/java/c
n
/ibizlab/codegen/lite/MetaEntityModel.java
浏览文件 @
59774755
package
c
om
.
ibizlab
.
codegen
.
lite
;
package
c
n
.
ibizlab
.
codegen
.
lite
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.annotation.JSONField
;
...
...
@@ -6,7 +6,7 @@ import com.fasterxml.jackson.annotation.JsonFormat;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
import
com.fasterxml.jackson.annotation.JsonIgnoreProperties
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
c
om
.ibizlab.codegen.utils.DataObject
;
import
c
n
.ibizlab.codegen.utils.DataObject
;
import
lombok.Getter
;
import
lombok.NoArgsConstructor
;
import
lombok.Setter
;
...
...
modules/ibizlab-generator-core/src/main/java/c
om
/ibizlab/codegen/lite/MetaFieldModel.java
→
modules/ibizlab-generator-core/src/main/java/c
n
/ibizlab/codegen/lite/MetaFieldModel.java
浏览文件 @
59774755
package
c
om
.
ibizlab
.
codegen
.
lite
;
package
c
n
.
ibizlab
.
codegen
.
lite
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.annotation.JSONField
;
...
...
@@ -6,7 +6,7 @@ import com.fasterxml.jackson.annotation.JsonFormat;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
import
com.fasterxml.jackson.annotation.JsonIgnoreProperties
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
c
om
.ibizlab.codegen.utils.DataObject
;
import
c
n
.ibizlab.codegen.utils.DataObject
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Getter
;
...
...
modules/ibizlab-generator-core/src/main/java/c
om
/ibizlab/codegen/lite/MetaLookupModel.java
→
modules/ibizlab-generator-core/src/main/java/c
n
/ibizlab/codegen/lite/MetaLookupModel.java
浏览文件 @
59774755
package
c
om
.
ibizlab
.
codegen
.
lite
;
package
c
n
.
ibizlab
.
codegen
.
lite
;
import
com.alibaba.fastjson.annotation.JSONField
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
...
...
modules/ibizlab-generator-core/src/main/java/c
om
/ibizlab/codegen/lite/MetaRelationshipModel.java
→
modules/ibizlab-generator-core/src/main/java/c
n
/ibizlab/codegen/lite/MetaRelationshipModel.java
浏览文件 @
59774755
package
c
om
.
ibizlab
.
codegen
.
lite
;
package
c
n
.
ibizlab
.
codegen
.
lite
;
import
com.alibaba.fastjson.annotation.JSONField
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
...
...
modules/ibizlab-generator-core/src/main/java/c
om
/ibizlab/codegen/lite/RelationshipModel.java
→
modules/ibizlab-generator-core/src/main/java/c
n
/ibizlab/codegen/lite/RelationshipModel.java
浏览文件 @
59774755
package
c
om
.
ibizlab
.
codegen
.
lite
;
package
c
n
.
ibizlab
.
codegen
.
lite
;
import
com.alibaba.fastjson.annotation.JSONField
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
...
...
modules/ibizlab-generator-core/src/main/java/c
om
/ibizlab/codegen/lite/Setting.java
→
modules/ibizlab-generator-core/src/main/java/c
n
/ibizlab/codegen/lite/Setting.java
浏览文件 @
59774755
package
c
om
.
ibizlab
.
codegen
.
lite
;
package
c
n
.
ibizlab
.
codegen
.
lite
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
c
om
.ibizlab.codegen.utils.DataObject
;
import
c
n
.ibizlab.codegen.utils.DataObject
;
import
lombok.Getter
;
import
lombok.NoArgsConstructor
;
import
lombok.Setter
;
...
...
modules/ibizlab-generator-core/src/main/java/c
om
/ibizlab/codegen/model/CliOption.java
→
modules/ibizlab-generator-core/src/main/java/c
n
/ibizlab/codegen/model/CliOption.java
浏览文件 @
59774755
package
c
om
.
ibizlab
.
codegen
.
model
;
package
c
n
.
ibizlab
.
codegen
.
model
;
import
com.alibaba.fastjson.annotation.JSONField
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
import
com.fasterxml.jackson.annotation.JsonIgnoreProperties
;
import
com.fasterxml.jackson.annotation.JsonInclude
;
import
com.ibizlab.codegen.CodegenConstants
;
import
org.springframework.util.StringUtils
;
import
cn.ibizlab.codegen.CodegenConstants
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Map
;
@JsonInclude
(
JsonInclude
.
Include
.
NON_EMPTY
)
...
...
modules/ibizlab-generator-core/src/main/java/c
om
/ibizlab/codegen/model/DSLink.java
→
modules/ibizlab-generator-core/src/main/java/c
n
/ibizlab/codegen/model/DSLink.java
浏览文件 @
59774755
package
c
om
.
ibizlab
.
codegen
.
model
;
package
c
n
.
ibizlab
.
codegen
.
model
;
import
com.alibaba.fastjson.annotation.JSONField
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
...
...
modules/ibizlab-generator-core/src/main/java/c
om
/ibizlab/codegen/model/DataObj.java
→
modules/ibizlab-generator-core/src/main/java/c
n
/ibizlab/codegen/model/DataObj.java
浏览文件 @
59774755
package
c
om
.
ibizlab
.
codegen
.
model
;
package
c
n
.
ibizlab
.
codegen
.
model
;
import
cn.ibizlab.codegen.utils.DataObject
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.ibizlab.codegen.utils.DataObject
;
import
org.springframework.util.ObjectUtils
;
import
java.math.BigDecimal
;
...
...
modules/ibizlab-generator-core/src/main/java/c
om
/ibizlab/codegen/model/ModelStorage.java
→
modules/ibizlab-generator-core/src/main/java/c
n
/ibizlab/codegen/model/ModelStorage.java
浏览文件 @
59774755
package
c
om
.
ibizlab
.
codegen
.
model
;
package
c
n
.
ibizlab
.
codegen
.
model
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.TypeReference
;
import
com.ibizlab.codegen.CodegenConfig
;
import
com.ibizlab.codegen.CodegenConstants
;
import
com.ibizlab.codegen.lite.DynamicModelStorage
;
import
com.ibizlab.codegen.lite.EntityModel
;
import
cn.ibizlab.codegen.lite.DynamicModelStorage
;
import
cn.ibizlab.codegen.lite.EntityModel
;
import
cn.ibizlab.codegen.CodegenConfig
;
import
cn.ibizlab.codegen.CodegenConstants
;
import
c
om
.ibizlab.codegen.templating.TemplateFileType
;
import
c
n
.ibizlab.codegen.templating.TemplateFileType
;
import
net.ibizsys.model.IPSSystem
;
import
org.springframework.util.Assert
;
import
org.springframework.util.StringUtils
;
import
java.io.File
;
import
java.io.IOException
;
import
java.nio.charset.StandardCharsets
;
import
java.nio.file.Files
;
import
java.nio.file.Path
;
import
java.nio.file.Paths
;
import
java.util.*
;
...
...
@@ -79,11 +71,11 @@ public class ModelStorage {
return
schema
;
}
private
Map
<
TemplateFileType
,
List
<
CliOption
>>
store
=
new
HashMap
<>();
private
Map
<
TemplateFileType
,
List
<
CliOption
>>
templateData
=
new
HashMap
<>();
public
List
<
CliOption
>
get
Store
(
TemplateFileType
type
)
public
List
<
CliOption
>
get
TemplateData
(
TemplateFileType
type
)
{
if
(!
store
.
containsKey
(
type
))
if
(!
templateData
.
containsKey
(
type
))
{
List
<
CliOption
>
rt
=
new
ArrayList
();
if
(
type
.
equals
(
TemplateFileType
.
api
))
...
...
@@ -127,9 +119,14 @@ public class ModelStorage {
rt
.
add
(
opt
);
});
}
store
.
put
(
type
,
rt
);
else
if
(
type
.
equals
(
TemplateFileType
.
supportingFiles
))
{
CliOption
opt
=
newCliOption
();
rt
.
add
(
opt
);
}
templateData
.
put
(
type
,
rt
);
}
return
store
.
get
(
type
);
return
templateData
.
get
(
type
);
}
...
...
modules/ibizlab-generator-core/src/main/java/c
om
/ibizlab/codegen/model/POSchema.java
→
modules/ibizlab-generator-core/src/main/java/c
n
/ibizlab/codegen/model/POSchema.java
浏览文件 @
59774755
package
c
om
.
ibizlab
.
codegen
.
model
;
package
c
n
.
ibizlab
.
codegen
.
model
;
import
cn.ibizlab.codegen.utils.DataObject
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.annotation.JSONField
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
import
com.fasterxml.jackson.annotation.JsonIgnoreProperties
;
import
com.fasterxml.jackson.annotation.JsonInclude
;
import
com.ibizlab.codegen.utils.DataObject
;
import
lombok.Getter
;
import
lombok.NoArgsConstructor
;
import
lombok.Setter
;
...
...
modules/ibizlab-generator-core/src/main/java/c
om
/ibizlab/codegen/model/PojoOption.java
→
modules/ibizlab-generator-core/src/main/java/c
n
/ibizlab/codegen/model/PojoOption.java
浏览文件 @
59774755
package
c
om
.
ibizlab
.
codegen
.
model
;
package
c
n
.
ibizlab
.
codegen
.
model
;
import
com.alibaba.fastjson.annotation.JSONField
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
...
...
modules/ibizlab-generator-core/src/main/java/c
om
/ibizlab/codegen/model/PojoSchema.java
→
modules/ibizlab-generator-core/src/main/java/c
n
/ibizlab/codegen/model/PojoSchema.java
浏览文件 @
59774755
package
c
om
.
ibizlab
.
codegen
.
model
;
package
c
n
.
ibizlab
.
codegen
.
model
;
import
com.alibaba.fastjson.JSON
;
...
...
@@ -7,14 +7,13 @@ import com.alibaba.fastjson.annotation.JSONField;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
import
com.fasterxml.jackson.annotation.JsonIgnoreProperties
;
import
com.fasterxml.jackson.annotation.JsonInclude
;
import
c
om
.ibizlab.codegen.utils.Inflector
;
import
c
n
.ibizlab.codegen.utils.Inflector
;
import
lombok.Getter
;
import
lombok.NoArgsConstructor
;
import
lombok.Setter
;
import
lombok.experimental.Accessors
;
import
net.ibizsys.model.dataentity.IPSDataEntity
;
import
net.ibizsys.model.dataentity.defield.IPSDEField
;
import
net.ibizsys.model.dataentity.defield.PSDEFieldImpl
;
import
org.springframework.util.StringUtils
;
import
java.io.File
;
...
...
modules/ibizlab-generator-core/src/main/java/c
om
/ibizlab/codegen/model/TransUtils.java
→
modules/ibizlab-generator-core/src/main/java/c
n
/ibizlab/codegen/model/TransUtils.java
浏览文件 @
59774755
package
c
om
.
ibizlab
.
codegen
.
model
;
package
c
n
.
ibizlab
.
codegen
.
model
;
import
cn.ibizlab.codegen.lite.*
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
c
om
.ibizlab.codegen.lite.*
;
import
c
n
.ibizlab.codegen.lite.*
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.util.StringUtils
;
...
...
modules/ibizlab-generator-core/src/main/java/cn/ibizlab/codegen/package-info.java
0 → 100644
浏览文件 @
59774755
package
cn
.
ibizlab
.
codegen
;
\ No newline at end of file
modules/ibizlab-generator-core/src/main/java/c
om
/ibizlab/codegen/templating/CommonTemplateContentLocator.java
→
modules/ibizlab-generator-core/src/main/java/c
n
/ibizlab/codegen/templating/CommonTemplateContentLocator.java
浏览文件 @
59774755
package
c
om
.
ibizlab
.
codegen
.
templating
;
package
c
n
.
ibizlab
.
codegen
.
templating
;
import
org.apache.commons.lang3.StringUtils
;
...
...
modules/ibizlab-generator-core/src/main/java/c
om
/ibizlab/codegen/templating/GeneratorTemplateContentLocator.java
→
modules/ibizlab-generator-core/src/main/java/c
n
/ibizlab/codegen/templating/GeneratorTemplateContentLocator.java
浏览文件 @
59774755
package
c
om
.
ibizlab
.
codegen
.
templating
;
package
c
n
.
ibizlab
.
codegen
.
templating
;
import
c
om
.ibizlab.codegen.CodegenConfig
;
import
c
n
.ibizlab.codegen.CodegenConfig
;
import
java.io.File
;
...
...
modules/ibizlab-generator-core/src/main/java/c
om
/ibizlab/codegen/templating/MustacheEngineAdapter.java
→
modules/ibizlab-generator-core/src/main/java/c
n
/ibizlab/codegen/templating/MustacheEngineAdapter.java
浏览文件 @
59774755
...
...
@@ -14,7 +14,7 @@
* limitations under the License.
*/
package
c
om
.
ibizlab
.
codegen
.
templating
;
package
c
n
.
ibizlab
.
codegen
.
templating
;
import
com.samskivert.mustache.Mustache
;
import
com.samskivert.mustache.Template
;
...
...
modules/ibizlab-generator-core/src/main/java/c
om
/ibizlab/codegen/templating/TemplateDefinition.java
→
modules/ibizlab-generator-core/src/main/java/c
n
/ibizlab/codegen/templating/TemplateDefinition.java
浏览文件 @
59774755
package
c
om
.
ibizlab
.
codegen
.
templating
;
package
c
n
.
ibizlab
.
codegen
.
templating
;
import
cn.ibizlab.codegen.model.CliOption
;
import
cn.ibizlab.codegen.model.ModelStorage
;
import
lombok.Getter
;
import
lombok.NoArgsConstructor
;
import
lombok.Setter
;
import
lombok.experimental.Accessors
;
import
org.springframework.util.StringUtils
;
import
java.nio.file.Paths
;
import
java.nio.file.Path
;
import
java.util.Arrays
;
import
java.util.List
;
@Getter
@Setter
...
...
@@ -12,16 +19,34 @@ import lombok.experimental.Accessors;
@Accessors
(
chain
=
true
)
public
class
TemplateDefinition
{
private
String
templateFile
;
private
String
destinationFilename
;
protected
TemplateFileType
templateType
;
protected
List
<
CliOption
>
templateDatas
;
public
TemplateDefinition
(
String
templateFile
)
{
if
(
templateFile
==
null
)
throw
new
IllegalArgumentException
(
"templateFile may not be null."
);
if
(
destinationFilename
==
null
)
throw
new
IllegalArgumentException
(
"destinationFilename may not be null."
);
this
.
templateFile
=
templateFile
;
this
.
destinationFilename
=
destinationFilename
;
this
.
templateType
=
TemplateFileType
.
supportingFiles
;
this
.
templateType
=
getType
(
Paths
.
get
(
this
.
templateFile
));
this
.
templateDatas
=
ModelStorage
.
getInstance
().
getTemplateData
(
this
.
templateType
);
}
private
TemplateFileType
getType
(
Path
path
)
{
if
(
path
==
null
)
return
TemplateFileType
.
supportingFiles
;
if
(
StringUtils
.
isEmpty
(
path
.
getFileName
()))
return
TemplateFileType
.
supportingFiles
;
String
fileName
=
path
.
getFileName
().
toString
();
for
(
TemplateFileType
type:
TemplateFileType
.
values
())
{
if
(
fileName
.
indexOf
(
"{{"
+
type
.
name
()+
"}}"
)>=
0
||
fileName
.
indexOf
(
"{{"
+
type
.
value
()+
"}}"
)>=
0
)
return
type
;
}
return
getType
(
path
.
getParent
());
}
}
modules/ibizlab-generator-core/src/main/java/c
om
/ibizlab/codegen/templating/TemplateFileType.java
→
modules/ibizlab-generator-core/src/main/java/c
n
/ibizlab/codegen/templating/TemplateFileType.java
浏览文件 @
59774755
package
c
om
.
ibizlab
.
codegen
.
templating
;
package
c
n
.
ibizlab
.
codegen
.
templating
;
public
enum
TemplateFileType
{
...
...
modules/ibizlab-generator-core/src/main/java/c
om
/ibizlab/codegen/templating/TemplateManager.java
→
modules/ibizlab-generator-core/src/main/java/c
n
/ibizlab/codegen/templating/TemplateManager.java
浏览文件 @
59774755
package
c
om
.
ibizlab
.
codegen
.
templating
;
package
c
n
.
ibizlab
.
codegen
.
templating
;
import
org.apache.commons.lang3.StringUtils
;
...
...
modules/ibizlab-generator-core/src/main/java/c
om
/ibizlab/codegen/templating/TemplateManagerOptions.java
→
modules/ibizlab-generator-core/src/main/java/c
n
/ibizlab/codegen/templating/TemplateManagerOptions.java
浏览文件 @
59774755
package
c
om
.
ibizlab
.
codegen
.
templating
;
package
c
n
.
ibizlab
.
codegen
.
templating
;
/**
* Holds the options relevant to template management and execution.
...
...
modules/ibizlab-generator-core/src/main/java/c
om
/ibizlab/codegen/templating/TemplateNotFoundException.java
→
modules/ibizlab-generator-core/src/main/java/c
n
/ibizlab/codegen/templating/TemplateNotFoundException.java
浏览文件 @
59774755
package
c
om
.
ibizlab
.
codegen
.
templating
;
package
c
n
.
ibizlab
.
codegen
.
templating
;
public
class
TemplateNotFoundException
extends
RuntimeException
{
/**
...
...
modules/ibizlab-generator-core/src/main/java/c
om
/ibizlab/codegen/templating/TemplatePathLocator.java
→
modules/ibizlab-generator-core/src/main/java/c
n
/ibizlab/codegen/templating/TemplatePathLocator.java
浏览文件 @
59774755
package
c
om
.
ibizlab
.
codegen
.
templating
;
package
c
n
.
ibizlab
.
codegen
.
templating
;
/**
* Provides means for searching for "actual" template location based on relative template file.
...
...
modules/ibizlab-generator-core/src/main/java/c
om
/ibizlab/codegen/templating/TemplateProcessor.java
→
modules/ibizlab-generator-core/src/main/java/c
n
/ibizlab/codegen/templating/TemplateProcessor.java
浏览文件 @
59774755
package
c
om
.
ibizlab
.
codegen
.
templating
;
package
c
n
.
ibizlab
.
codegen
.
templating
;
import
java.io.File
;
import
java.io.IOException
;
...
...
modules/ibizlab-generator-core/src/main/java/c
om
/ibizlab/codegen/templating/TemplatingEngineAdapter.java
→
modules/ibizlab-generator-core/src/main/java/c
n
/ibizlab/codegen/templating/TemplatingEngineAdapter.java
浏览文件 @
59774755
...
...
@@ -14,7 +14,7 @@
* limitations under the License.
*/
package
c
om
.
ibizlab
.
codegen
.
templating
;
package
c
n
.
ibizlab
.
codegen
.
templating
;
import
java.io.FileInputStream
;
import
java.io.IOException
;
...
...
modules/ibizlab-generator-core/src/main/java/c
om
/ibizlab/codegen/templating/TemplatingEngineLoader.java
→
modules/ibizlab-generator-core/src/main/java/c
n
/ibizlab/codegen/templating/TemplatingEngineLoader.java
浏览文件 @
59774755
...
...
@@ -14,7 +14,7 @@
* limitations under the License.
*/
package
c
om
.
ibizlab
.
codegen
.
templating
;
package
c
n
.
ibizlab
.
codegen
.
templating
;
import
java.util.Locale
;
...
...
modules/ibizlab-generator-core/src/main/java/c
om
/ibizlab/codegen/templating/TemplatingExecutor.java
→
modules/ibizlab-generator-core/src/main/java/c
n
/ibizlab/codegen/templating/TemplatingExecutor.java
浏览文件 @
59774755
package
c
om
.
ibizlab
.
codegen
.
templating
;
package
c
n
.
ibizlab
.
codegen
.
templating
;
import
java.nio.file.Path
;
...
...
modules/ibizlab-generator-core/src/main/java/c
om
/ibizlab/codegen/templating/mustache/CamelCaseLambda.java
→
modules/ibizlab-generator-core/src/main/java/c
n
/ibizlab/codegen/templating/mustache/CamelCaseLambda.java
浏览文件 @
59774755
...
...
@@ -15,16 +15,17 @@
* limitations under the License.
*/
package
c
om
.
ibizlab
.
codegen
.
templating
.
mustache
;
package
c
n
.
ibizlab
.
codegen
.
templating
.
mustache
;
import
com.ibizlab.codegen.CodegenConfig
;
import
cn.ibizlab.codegen.utils.StringAdvUtils
;
import
cn.ibizlab.codegen.CodegenConfig
;
import
com.samskivert.mustache.Mustache
;
import
com.samskivert.mustache.Template
;
import
java.io.IOException
;
import
java.io.Writer
;
import
static
c
om
.
ibizlab
.
codegen
.
utils
.
StringAdvUtils
.
camelize
;
import
static
c
n
.
ibizlab
.
codegen
.
utils
.
StringAdvUtils
.
camelize
;
/**
...
...
@@ -63,7 +64,7 @@ public class CamelCaseLambda implements Mustache.Lambda {
@Override
public
void
execute
(
Template
.
Fragment
fragment
,
Writer
writer
)
throws
IOException
{
String
text
=
camelize
(
fragment
.
execute
(),
lowercaseFirstLetter
);
String
text
=
StringAdvUtils
.
camelize
(
fragment
.
execute
(),
lowercaseFirstLetter
);
if
(
generator
!=
null
)
{
text
=
generator
.
sanitizeName
(
text
);
...
...
modules/ibizlab-generator-core/src/main/java/c
om
/ibizlab/codegen/templating/mustache/CaseFormatLambda.java
→
modules/ibizlab-generator-core/src/main/java/c
n
/ibizlab/codegen/templating/mustache/CaseFormatLambda.java
浏览文件 @
59774755
package
c
om
.
ibizlab
.
codegen
.
templating
.
mustache
;
package
c
n
.
ibizlab
.
codegen
.
templating
.
mustache
;
import
com.google.common.base.CaseFormat
;
import
c
om
.ibizlab.codegen.CodegenConfig
;
import
c
n
.ibizlab.codegen.CodegenConfig
;
import
com.samskivert.mustache.Mustache
;
import
com.samskivert.mustache.Template
;
...
...
modules/ibizlab-generator-core/src/main/java/c
om
/ibizlab/codegen/templating/mustache/IndentedLambda.java
→
modules/ibizlab-generator-core/src/main/java/c
n
/ibizlab/codegen/templating/mustache/IndentedLambda.java
浏览文件 @
59774755
...
...
@@ -15,7 +15,7 @@
* limitations under the License.
*/
package
c
om
.
ibizlab
.
codegen
.
templating
.
mustache
;
package
c
n
.
ibizlab
.
codegen
.
templating
.
mustache
;
import
com.samskivert.mustache.Mustache
;
import
com.samskivert.mustache.Template
;
...
...
modules/ibizlab-generator-core/src/main/java/c
om
/ibizlab/codegen/templating/mustache/JoinWithCommaLambda.java
→
modules/ibizlab-generator-core/src/main/java/c
n
/ibizlab/codegen/templating/mustache/JoinWithCommaLambda.java
浏览文件 @
59774755
...
...
@@ -15,9 +15,9 @@
* limitations under the License.
*/
package
c
om
.
ibizlab
.
codegen
.
templating
.
mustache
;
package
c
n
.
ibizlab
.
codegen
.
templating
.
mustache
;
import
c
om
.ibizlab.codegen.CodegenConfig
;
import
c
n
.ibizlab.codegen.CodegenConfig
;
import
com.samskivert.mustache.Mustache
;
import
com.samskivert.mustache.Template
;
...
...
modules/ibizlab-generator-core/src/main/java/c
om
/ibizlab/codegen/templating/mustache/LowercaseLambda.java
→
modules/ibizlab-generator-core/src/main/java/c
n
/ibizlab/codegen/templating/mustache/LowercaseLambda.java
浏览文件 @
59774755
...
...
@@ -15,9 +15,9 @@
* limitations under the License.
*/
package
c
om
.
ibizlab
.
codegen
.
templating
.
mustache
;
package
c
n
.
ibizlab
.
codegen
.
templating
.
mustache
;
import
c
om
.ibizlab.codegen.CodegenConfig
;
import
c
n
.ibizlab.codegen.CodegenConfig
;
import
com.samskivert.mustache.Mustache
;
import
com.samskivert.mustache.Template
;
...
...
modules/ibizlab-generator-core/src/main/java/c
om
/ibizlab/codegen/templating/mustache/OnChangeLambda.java
→
modules/ibizlab-generator-core/src/main/java/c
n
/ibizlab/codegen/templating/mustache/OnChangeLambda.java
浏览文件 @
59774755
package
c
om
.
ibizlab
.
codegen
.
templating
.
mustache
;
package
c
n
.
ibizlab
.
codegen
.
templating
.
mustache
;
import
com.samskivert.mustache.Mustache
;
import
com.samskivert.mustache.Template
;
...
...
modules/ibizlab-generator-core/src/main/java/c
om
/ibizlab/codegen/templating/mustache/PrefixWithHashLambda.java
→
modules/ibizlab-generator-core/src/main/java/c
n
/ibizlab/codegen/templating/mustache/PrefixWithHashLambda.java
浏览文件 @
59774755
...
...
@@ -15,7 +15,7 @@
* limitations under the License.
*/
package
c
om
.
ibizlab
.
codegen
.
templating
.
mustache
;
package
c
n
.
ibizlab
.
codegen
.
templating
.
mustache
;
import
com.samskivert.mustache.Mustache
;
import
com.samskivert.mustache.Template.Fragment
;
...
...
modules/ibizlab-generator-core/src/main/java/c
om
/ibizlab/codegen/templating/mustache/SnakecaseLambda.java
→
modules/ibizlab-generator-core/src/main/java/c
n
/ibizlab/codegen/templating/mustache/SnakecaseLambda.java
浏览文件 @
59774755
...
...
@@ -14,16 +14,15 @@
* limitations under the License.
*/
package
c
om
.
ibizlab
.
codegen
.
templating
.
mustache
;
package
c
n
.
ibizlab
.
codegen
.
templating
.
mustache
;
import
cn.ibizlab.codegen.utils.StringAdvUtils
;
import
com.samskivert.mustache.Mustache
;
import
com.samskivert.mustache.Template
;
import
java.io.IOException
;
import
java.io.Writer
;
import
static
com
.
ibizlab
.
codegen
.
utils
.
StringAdvUtils
.
underscore
;
/**
* Converts text in a fragment to snake case.
...
...
@@ -41,6 +40,6 @@ import static com.ibizlab.codegen.utils.StringAdvUtils.underscore;
public
class
SnakecaseLambda
implements
Mustache
.
Lambda
{
@Override
public
void
execute
(
Template
.
Fragment
fragment
,
Writer
writer
)
throws
IOException
{
writer
.
write
(
underscore
(
fragment
.
execute
()));
writer
.
write
(
StringAdvUtils
.
underscore
(
fragment
.
execute
()));
}
}
modules/ibizlab-generator-core/src/main/java/c
om
/ibizlab/codegen/templating/mustache/SplitStringLambda.java
→
modules/ibizlab-generator-core/src/main/java/c
n
/ibizlab/codegen/templating/mustache/SplitStringLambda.java
浏览文件 @
59774755
...
...
@@ -15,7 +15,7 @@
* limitations under the License.
*/
package
c
om
.
ibizlab
.
codegen
.
templating
.
mustache
;
package
c
n
.
ibizlab
.
codegen
.
templating
.
mustache
;
import
com.samskivert.mustache.Mustache
;
import
com.samskivert.mustache.Template.Fragment
;
...
...
modules/ibizlab-generator-core/src/main/java/c
om
/ibizlab/codegen/templating/mustache/TitlecaseLambda.java
→
modules/ibizlab-generator-core/src/main/java/c
n
/ibizlab/codegen/templating/mustache/TitlecaseLambda.java
浏览文件 @
59774755
...
...
@@ -15,7 +15,7 @@
* limitations under the License.
*/
package
c
om
.
ibizlab
.
codegen
.
templating
.
mustache
;
package
c
n
.
ibizlab
.
codegen
.
templating
.
mustache
;
import
com.samskivert.mustache.Mustache
;
import
com.samskivert.mustache.Template
;
...
...
modules/ibizlab-generator-core/src/main/java/c
om
/ibizlab/codegen/templating/mustache/TrimWhitespaceLambda.java
→
modules/ibizlab-generator-core/src/main/java/c
n
/ibizlab/codegen/templating/mustache/TrimWhitespaceLambda.java
浏览文件 @
59774755
...
...
@@ -15,7 +15,7 @@
* limitations under the License.
*/
package
c
om
.
ibizlab
.
codegen
.
templating
.
mustache
;
package
c
n
.
ibizlab
.
codegen
.
templating
.
mustache
;
import
com.samskivert.mustache.Mustache
;
import
com.samskivert.mustache.Template.Fragment
;
...
...
modules/ibizlab-generator-core/src/main/java/c
om
/ibizlab/codegen/templating/mustache/UppercaseLambda.java
→
modules/ibizlab-generator-core/src/main/java/c
n
/ibizlab/codegen/templating/mustache/UppercaseLambda.java
浏览文件 @
59774755
...
...
@@ -15,7 +15,7 @@
* limitations under the License.
*/
package
c
om
.
ibizlab
.
codegen
.
templating
.
mustache
;
package
c
n
.
ibizlab
.
codegen
.
templating
.
mustache
;
import
com.samskivert.mustache.Mustache
;
import
com.samskivert.mustache.Template
;
...
...
modules/ibizlab-generator-core/src/main/java/c
om
/ibizlab/codegen/utils/DataObject.java
→
modules/ibizlab-generator-core/src/main/java/c
n
/ibizlab/codegen/utils/DataObject.java
浏览文件 @
59774755
package
c
om
.
ibizlab
.
codegen
.
utils
;
package
c
n
.
ibizlab
.
codegen
.
utils
;
import
com.alibaba.fastjson.JSONArray
;
...
...
modules/ibizlab-generator-core/src/main/java/c
om
/ibizlab/codegen/utils/ImplementationVersion.java
→
modules/ibizlab-generator-core/src/main/java/c
n
/ibizlab/codegen/utils/ImplementationVersion.java
浏览文件 @
59774755
...
...
@@ -15,7 +15,7 @@
* limitations under the License.
*/
package
c
om
.
ibizlab
.
codegen
.
utils
;
package
c
n
.
ibizlab
.
codegen
.
utils
;
public
class
ImplementationVersion
{
public
static
String
read
()
{
...
...
modules/ibizlab-generator-core/src/main/java/c
om
/ibizlab/codegen/utils/Inflector.java
→
modules/ibizlab-generator-core/src/main/java/c
n
/ibizlab/codegen/utils/Inflector.java
浏览文件 @
59774755
package
c
om
.
ibizlab
.
codegen
.
utils
;
package
c
n
.
ibizlab
.
codegen
.
utils
;
import
java.util.ArrayList
;
import
java.util.List
;
...
...
modules/ibizlab-generator-core/src/main/java/c
om
/ibizlab/codegen/utils/Markdown.java
→
modules/ibizlab-generator-core/src/main/java/c
n
/ibizlab/codegen/utils/Markdown.java
浏览文件 @
59774755
...
...
@@ -15,7 +15,7 @@
* limitations under the License.
*/
package
c
om
.
ibizlab
.
codegen
.
utils
;
package
c
n
.
ibizlab
.
codegen
.
utils
;
import
org.commonmark.node.Node
;
import
org.commonmark.parser.Parser
;
...
...
modules/ibizlab-generator-core/src/main/java/c
om
/ibizlab/codegen/utils/OptionUtils.java
→
modules/ibizlab-generator-core/src/main/java/c
n
/ibizlab/codegen/utils/OptionUtils.java
浏览文件 @
59774755
...
...
@@ -15,7 +15,7 @@
* limitations under the License.
*/
package
c
om
.
ibizlab
.
codegen
.
utils
;
package
c
n
.
ibizlab
.
codegen
.
utils
;
import
org.apache.commons.lang3.tuple.Pair
;
...
...
modules/ibizlab-generator-core/src/main/java/c
om
/ibizlab/codegen/utils/StringAdvUtils.java
→
modules/ibizlab-generator-core/src/main/java/c
n
/ibizlab/codegen/utils/StringAdvUtils.java
浏览文件 @
59774755
package
c
om
.
ibizlab
.
codegen
.
utils
;
package
c
n
.
ibizlab
.
codegen
.
utils
;
import
com.github.benmanes.caffeine.cache.Cache
;
import
com.github.benmanes.caffeine.cache.Caffeine
;
import
com.github.benmanes.caffeine.cache.Ticker
;
import
c
om
.ibizlab.codegen.config.GlobalSettings
;
import
c
n
.ibizlab.codegen.config.GlobalSettings
;
import
org.apache.commons.lang3.tuple.ImmutablePair
;
import
org.apache.commons.lang3.tuple.Pair
;
...
...
@@ -17,11 +17,11 @@ public class StringAdvUtils {
/**
* Set the cache size (entry count) of the sanitizedNameCache, camelizedWordsCache and underscoreWordsCache.
*/
public
static
final
String
NAME_CACHE_SIZE_PROPERTY
=
"c
om
.ibizlab.codegen.utils.namecache.cachesize"
;
public
static
final
String
NAME_CACHE_SIZE_PROPERTY
=
"c
n
.ibizlab.codegen.utils.namecache.cachesize"
;
/**
* Set the cache expiry (in seconds) of the sanitizedNameCache, camelizedWordsCache and underscoreWordsCache.
*/
public
static
final
String
NAME_CACHE_EXPIRY_PROPERTY
=
"c
om
.ibizlab.codegen.utils.namecache.expireafter.seconds"
;
public
static
final
String
NAME_CACHE_EXPIRY_PROPERTY
=
"c
n
.ibizlab.codegen.utils.namecache.expireafter.seconds"
;
// A cache of camelized words. The camelize() method is invoked many times with the same
// arguments, this cache is used to optimized performance.
...
...
modules/ibizlab-generator-core/src/main/java/com/ibizlab/codegen/CliOption.java
已删除
100644 → 0
浏览文件 @
a724efdb
/*
* Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech)
* Copyright 2018 SmartBear Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
com
.
ibizlab
.
codegen
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
import
io.swagger.v3.parser.util.SchemaTypeUtil
;
import
java.util.LinkedHashMap
;
import
java.util.Map
;
public
class
CliOption
{
private
final
String
opt
;
private
String
description
;
private
String
type
;
private
String
defaultValue
;
private
String
optValue
;
private
Map
<
String
,
String
>
enumValues
;
public
CliOption
(
String
opt
,
String
description
)
{
this
(
opt
,
description
,
SchemaTypeUtil
.
STRING_TYPE
);
}
public
CliOption
(
String
opt
,
String
description
,
String
type
)
{
this
.
opt
=
opt
;
this
.
description
=
description
;
this
.
type
=
type
;
}
public
String
getOpt
()
{
return
opt
;
}
public
String
getDescription
()
{
return
description
;
}
public
void
setDescription
(
String
description
)
{
this
.
description
=
description
;
}
public
String
getType
()
{
return
type
;
}
public
void
setType
(
String
type
)
{
this
.
type
=
type
;
}
public
String
getDefault
()
{
return
defaultValue
;
}
public
void
setDefault
(
String
defaultValue
)
{
this
.
defaultValue
=
defaultValue
;
}
public
CliOption
defaultValue
(
String
defaultValue
)
{
this
.
defaultValue
=
defaultValue
;
return
this
;
}
public
String
getOptValue
()
{
return
this
.
optValue
;
}
public
void
setOptValue
(
String
optValue
)
{
if
(
this
.
enumValues
!=
null
&&
this
.
enumValues
.
containsKey
(
optValue
))
{
this
.
optValue
=
optValue
;
}
else
{
this
.
optValue
=
null
;
}
}
public
CliOption
addEnum
(
String
value
,
String
description
)
{
if
(
this
.
enumValues
==
null
)
{
this
.
enumValues
=
new
LinkedHashMap
<
String
,
String
>();
}
if
(!
enumValues
.
containsKey
(
value
))
{
enumValues
.
put
(
value
,
description
);
}
return
this
;
}
public
Map
<
String
,
String
>
getEnum
()
{
return
enumValues
;
}
public
void
setEnum
(
Map
<
String
,
String
>
enumValues
)
{
this
.
enumValues
=
enumValues
;
}
/**
* Create new boolean command line option with a default of false
*
* @param opt Option name
* @param description Option description
* @return the CliOption created
*/
public
static
CliOption
newBoolean
(
String
opt
,
String
description
)
{
return
newBoolean
(
opt
,
description
,
false
);
}
/**
* Create new boolean command line option with the provided value as default
*
* @param opt Option name
* @param description Option description
* @param defaultValue the default value to use if option not specified
* @return the CliOption created
*/
public
static
CliOption
newBoolean
(
String
opt
,
String
description
,
boolean
defaultValue
)
{
return
new
CliOption
(
opt
,
description
,
SchemaTypeUtil
.
BOOLEAN_TYPE
).
defaultValue
(
String
.
valueOf
(
defaultValue
));
}
public
static
CliOption
newString
(
String
opt
,
String
description
)
{
return
new
CliOption
(
opt
,
description
,
SchemaTypeUtil
.
STRING_TYPE
);
}
@JsonIgnore
public
String
getOptionHelp
()
{
StringBuilder
sb
=
new
StringBuilder
(
description
);
if
(
defaultValue
!=
null
)
{
sb
.
append
(
" (Default: "
).
append
(
defaultValue
).
append
(
")"
);
}
if
(
enumValues
!=
null
)
{
for
(
Map
.
Entry
<
String
,
String
>
entry
:
enumValues
.
entrySet
())
{
sb
.
append
(
"\n "
).
append
(
entry
.
getKey
()).
append
(
" - "
).
append
(
entry
.
getValue
());
}
}
return
sb
.
toString
();
}
}
modules/ibizlab-generator-core/src/main/java/com/ibizlab/codegen/package-info.java
已删除
100644 → 0
浏览文件 @
a724efdb
package
com
.
ibizlab
.
codegen
;
\ No newline at end of file
pom.xml
浏览文件 @
59774755
...
...
@@ -6,7 +6,7 @@
<modelVersion>
4.0.0
</modelVersion>
<groupId>
c
om
.ibizlab
</groupId>
<groupId>
c
n
.ibizlab
</groupId>
<artifactId>
ibizlab-generator-project
</artifactId>
<packaging>
pom
</packaging>
<version>
1.0-SNAPSHOT
</version>
...
...
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录