Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
6f2a2af9
提交
6f2a2af9
authored
12月 19, 2012
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Formatting.
上级
9549cb57
显示空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
16 行增加
和
16 行删除
+16
-16
TableDefinition.java
h2/src/tools/org/h2/jaqu/TableDefinition.java
+2
-2
TableInspector.java
h2/src/tools/org/h2/jaqu/TableInspector.java
+14
-14
没有找到文件。
h2/src/tools/org/h2/jaqu/TableDefinition.java
浏览文件 @
6f2a2af9
...
@@ -269,7 +269,7 @@ class TableDefinition<T> {
...
@@ -269,7 +269,7 @@ class TableDefinition<T> {
/**
/**
* Optionally truncates strings to the maximum length
* Optionally truncates strings to the maximum length
*/
*/
private
Object
getValue
(
Object
obj
,
FieldDefinition
field
)
{
private
static
Object
getValue
(
Object
obj
,
FieldDefinition
field
)
{
Object
value
=
field
.
getValue
(
obj
);
Object
value
=
field
.
getValue
(
obj
);
if
(
field
.
trimString
&&
field
.
maxLength
>
0
)
{
if
(
field
.
trimString
&&
field
.
maxLength
>
0
)
{
if
(
value
instanceof
String
)
{
if
(
value
instanceof
String
)
{
...
@@ -499,7 +499,7 @@ class TableDefinition<T> {
...
@@ -499,7 +499,7 @@ class TableDefinition<T> {
* @param index the index columns, separated by space
* @param index the index columns, separated by space
* @return the column list
* @return the column list
*/
*/
private
List
<
String
>
getColumns
(
String
index
)
{
private
static
List
<
String
>
getColumns
(
String
index
)
{
List
<
String
>
cols
=
New
.
arrayList
();
List
<
String
>
cols
=
New
.
arrayList
();
if
(
index
==
null
||
index
.
length
()
==
0
)
{
if
(
index
==
null
||
index
.
length
()
==
0
)
{
return
null
;
return
null
;
...
...
h2/src/tools/org/h2/jaqu/TableInspector.java
浏览文件 @
6f2a2af9
...
@@ -40,7 +40,8 @@ import static org.h2.jaqu.ValidationRemark.warn;
...
@@ -40,7 +40,8 @@ import static org.h2.jaqu.ValidationRemark.warn;
*/
*/
public
class
TableInspector
{
public
class
TableInspector
{
private
final
static
int
todoReviewClass
=
0
;
private
static
final
int
todoReviewClass
=
0
;
private
static
final
String
EOL
=
"\n"
;
private
final
String
schema
;
private
final
String
schema
;
private
final
String
table
;
private
final
String
table
;
...
@@ -49,7 +50,6 @@ public class TableInspector {
...
@@ -49,7 +50,6 @@ public class TableInspector {
private
final
List
<
String
>
primaryKeys
=
New
.
arrayList
();
private
final
List
<
String
>
primaryKeys
=
New
.
arrayList
();
private
Map
<
String
,
IndexInspector
>
indexes
;
private
Map
<
String
,
IndexInspector
>
indexes
;
private
Map
<
String
,
ColumnInspector
>
columns
;
private
Map
<
String
,
ColumnInspector
>
columns
;
private
static
final
String
eol
=
"\n"
;
TableInspector
(
String
schema
,
String
table
,
boolean
forceUpperCase
,
TableInspector
(
String
schema
,
String
table
,
boolean
forceUpperCase
,
Class
<?
extends
java
.
util
.
Date
>
dateTimeClass
)
{
Class
<?
extends
java
.
util
.
Date
>
dateTimeClass
)
{
...
@@ -180,16 +180,16 @@ public class TableInspector {
...
@@ -180,16 +180,16 @@ public class TableInspector {
if
(!
StringUtils
.
isNullOrEmpty
(
packageName
))
{
if
(!
StringUtils
.
isNullOrEmpty
(
packageName
))
{
// package
// package
model
.
append
(
"package "
+
packageName
+
";"
);
model
.
append
(
"package "
+
packageName
+
";"
);
model
.
append
(
eol
).
append
(
eol
);
model
.
append
(
EOL
).
append
(
EOL
);
}
}
// imports
// imports
List
<
String
>
sortedImports
=
new
ArrayList
<
String
>(
imports
);
List
<
String
>
sortedImports
=
new
ArrayList
<
String
>(
imports
);
Collections
.
sort
(
sortedImports
);
Collections
.
sort
(
sortedImports
);
for
(
String
imp
:
sortedImports
)
{
for
(
String
imp
:
sortedImports
)
{
model
.
append
(
"import "
).
append
(
imp
).
append
(
';'
).
append
(
eol
);
model
.
append
(
"import "
).
append
(
imp
).
append
(
';'
).
append
(
EOL
);
}
}
model
.
append
(
eol
);
model
.
append
(
EOL
);
// @JQSchema
// @JQSchema
if
(
annotateSchema
&&
!
StringUtils
.
isNullOrEmpty
(
schema
))
{
if
(
annotateSchema
&&
!
StringUtils
.
isNullOrEmpty
(
schema
))
{
...
@@ -198,7 +198,7 @@ public class TableInspector {
...
@@ -198,7 +198,7 @@ public class TableInspector {
AnnotationBuilder
ap
=
new
AnnotationBuilder
();
AnnotationBuilder
ap
=
new
AnnotationBuilder
();
ap
.
addParameter
(
"name"
,
schema
);
ap
.
addParameter
(
"name"
,
schema
);
model
.
append
(
ap
);
model
.
append
(
ap
);
model
.
append
(
')'
).
append
(
eol
);
model
.
append
(
')'
).
append
(
EOL
);
}
}
// @JQTable
// @JQTable
...
@@ -220,7 +220,7 @@ public class TableInspector {
...
@@ -220,7 +220,7 @@ public class TableInspector {
// finish @JQTable annotation
// finish @JQTable annotation
model
.
append
(
ap
);
model
.
append
(
ap
);
model
.
append
(
')'
).
append
(
eol
);
model
.
append
(
')'
).
append
(
EOL
);
// @JQIndex
// @JQIndex
ap
=
new
AnnotationBuilder
();
ap
=
new
AnnotationBuilder
();
...
@@ -232,20 +232,20 @@ public class TableInspector {
...
@@ -232,20 +232,20 @@ public class TableInspector {
model
.
append
(
'@'
).
append
(
JQIndex
.
class
.
getSimpleName
());
model
.
append
(
'@'
).
append
(
JQIndex
.
class
.
getSimpleName
());
model
.
append
(
'('
);
model
.
append
(
'('
);
model
.
append
(
ap
);
model
.
append
(
ap
);
model
.
append
(
')'
).
append
(
eol
);
model
.
append
(
')'
).
append
(
EOL
);
}
}
// class declaration
// class declaration
String
clazzName
=
ModelUtils
.
convertTableToClassName
(
table
);
String
clazzName
=
ModelUtils
.
convertTableToClassName
(
table
);
model
.
append
(
MessageFormat
.
format
(
"public class {0} '{'"
,
clazzName
)).
append
(
eol
);
model
.
append
(
MessageFormat
.
format
(
"public class {0} '{'"
,
clazzName
)).
append
(
EOL
);
model
.
append
(
eol
);
model
.
append
(
EOL
);
// field declarations
// field declarations
model
.
append
(
fields
);
model
.
append
(
fields
);
// default constructor
// default constructor
model
.
append
(
"\t"
+
"public "
).
append
(
clazzName
).
append
(
"() {"
).
append
(
eol
);
model
.
append
(
"\t"
+
"public "
).
append
(
clazzName
).
append
(
"() {"
).
append
(
EOL
);
model
.
append
(
"\t}"
).
append
(
eol
);
model
.
append
(
"\t}"
).
append
(
EOL
);
// end of class body
// end of class body
model
.
append
(
'}'
);
model
.
append
(
'}'
);
...
@@ -348,7 +348,7 @@ public class TableInspector {
...
@@ -348,7 +348,7 @@ public class TableInspector {
}
}
sb
.
append
(
ap
.
toString
());
sb
.
append
(
ap
.
toString
());
}
}
sb
.
append
(
eol
);
sb
.
append
(
EOL
);
// variable declaration
// variable declaration
sb
.
append
(
"\t"
+
"public "
);
sb
.
append
(
"\t"
+
"public "
);
...
@@ -356,7 +356,7 @@ public class TableInspector {
...
@@ -356,7 +356,7 @@ public class TableInspector {
sb
.
append
(
' '
);
sb
.
append
(
' '
);
sb
.
append
(
column
);
sb
.
append
(
column
);
sb
.
append
(
';'
);
sb
.
append
(
';'
);
sb
.
append
(
eol
).
append
(
eol
);
sb
.
append
(
EOL
).
append
(
EOL
);
return
sb
;
return
sb
;
}
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论