Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
C
common
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
曲欣亮
common
Commits
cb8e9f42
Commit
cb8e9f42
authored
May 13, 2019
by
Quxl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
x
parent
f0dabfa2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
9 deletions
+10
-9
Util.java
src/main/java/com/egolm/common/Util.java
+10
-9
No files found.
src/main/java/com/egolm/common/Util.java
View file @
cb8e9f42
...
@@ -10,6 +10,7 @@ import java.util.Collection;
...
@@ -10,6 +10,7 @@ import java.util.Collection;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.Iterator
;
import
java.util.Iterator
;
import
java.util.LinkedHashMap
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.TreeMap
;
import
java.util.TreeMap
;
...
@@ -56,7 +57,7 @@ public class Util {
...
@@ -56,7 +57,7 @@ public class Util {
tmp
.
put
(
keys
[
i
],
value
);
tmp
.
put
(
keys
[
i
],
value
);
}
else
{
}
else
{
if
(
tmp
.
get
(
keys
[
i
])
==
null
)
{
if
(
tmp
.
get
(
keys
[
i
])
==
null
)
{
tmp
.
put
(
keys
[
i
],
new
HashMap
<
Object
,
Object
>());
tmp
.
put
(
keys
[
i
],
new
Linked
HashMap
<
Object
,
Object
>());
}
}
tmp
=
(
Map
<
Object
,
Object
>)
tmp
.
get
(
keys
[
i
]);
tmp
=
(
Map
<
Object
,
Object
>)
tmp
.
get
(
keys
[
i
]);
}
}
...
@@ -237,7 +238,7 @@ public class Util {
...
@@ -237,7 +238,7 @@ public class Util {
if
(
obj
==
null
)
{
if
(
obj
==
null
)
{
return
null
;
return
null
;
}
}
Map
<
String
,
Object
>
map
=
new
HashMap
<
String
,
Object
>();
Map
<
String
,
Object
>
map
=
new
Linked
HashMap
<
String
,
Object
>();
if
(
obj
instanceof
Map
)
{
if
(
obj
instanceof
Map
)
{
Map
<?,
?>
objMap
=
(
Map
<?,
?>)
obj
;
Map
<?,
?>
objMap
=
(
Map
<?,
?>)
obj
;
for
(
Object
key
:
objMap
.
keySet
())
{
for
(
Object
key
:
objMap
.
keySet
())
{
...
@@ -275,7 +276,7 @@ public class Util {
...
@@ -275,7 +276,7 @@ public class Util {
}
}
public
static
Map
<
String
,
String
>
ToMap
(
Map
<
String
,
String
[]>
parameterMap
)
{
public
static
Map
<
String
,
String
>
ToMap
(
Map
<
String
,
String
[]>
parameterMap
)
{
Map
<
String
,
String
>
resultMap
=
new
HashMap
<
String
,
String
>();
Map
<
String
,
String
>
resultMap
=
new
Linked
HashMap
<
String
,
String
>();
for
(
String
key
:
parameterMap
.
keySet
())
{
for
(
String
key
:
parameterMap
.
keySet
())
{
String
[]
valueArray
=
parameterMap
.
get
(
key
);
String
[]
valueArray
=
parameterMap
.
get
(
key
);
resultMap
.
put
(
String
.
valueOf
(
key
),
valueArray
.
length
>
0
?
valueArray
[
0
]
:
null
);
resultMap
.
put
(
String
.
valueOf
(
key
),
valueArray
.
length
>
0
?
valueArray
[
0
]
:
null
);
...
@@ -292,7 +293,7 @@ public class Util {
...
@@ -292,7 +293,7 @@ public class Util {
}
}
public
static
<
T
>
Map
<
String
,
T
>
objsToMM
(
List
<
T
>
objs
,
String
bar
,
String
...
keyNames
)
{
public
static
<
T
>
Map
<
String
,
T
>
objsToMM
(
List
<
T
>
objs
,
String
bar
,
String
...
keyNames
)
{
Map
<
String
,
T
>
maps
=
new
HashMap
<
String
,
T
>();
Map
<
String
,
T
>
maps
=
new
Linked
HashMap
<
String
,
T
>();
if
(
objs
!=
null
)
{
if
(
objs
!=
null
)
{
for
(
T
obj
:
objs
)
{
for
(
T
obj
:
objs
)
{
List
<
String
>
keyValues
=
new
ArrayList
<
String
>();
List
<
String
>
keyValues
=
new
ArrayList
<
String
>();
...
@@ -309,7 +310,7 @@ public class Util {
...
@@ -309,7 +310,7 @@ public class Util {
}
}
public
static
Map
<
String
,
Map
<
String
,
Object
>>
listToMM
(
List
<
Map
<
String
,
Object
>>
datas
,
String
bar
,
String
...
keyNames
)
{
public
static
Map
<
String
,
Map
<
String
,
Object
>>
listToMM
(
List
<
Map
<
String
,
Object
>>
datas
,
String
bar
,
String
...
keyNames
)
{
Map
<
String
,
Map
<
String
,
Object
>>
maps
=
new
HashMap
<
String
,
Map
<
String
,
Object
>>();
Map
<
String
,
Map
<
String
,
Object
>>
maps
=
new
Linked
HashMap
<
String
,
Map
<
String
,
Object
>>();
if
(
datas
!=
null
)
{
if
(
datas
!=
null
)
{
for
(
Map
<
String
,
Object
>
map
:
datas
)
{
for
(
Map
<
String
,
Object
>
map
:
datas
)
{
if
(
map
.
size
()
>
0
)
{
if
(
map
.
size
()
>
0
)
{
...
@@ -334,7 +335,7 @@ public class Util {
...
@@ -334,7 +335,7 @@ public class Util {
}
}
public
static
Map
<
String
,
List
<
Map
<
String
,
Object
>>>
listToML
(
List
<
Map
<
String
,
Object
>>
datas
,
String
keyName
)
{
public
static
Map
<
String
,
List
<
Map
<
String
,
Object
>>>
listToML
(
List
<
Map
<
String
,
Object
>>
datas
,
String
keyName
)
{
Map
<
String
,
List
<
Map
<
String
,
Object
>>>
mapDatas
=
new
HashMap
<
String
,
List
<
Map
<
String
,
Object
>>>();
Map
<
String
,
List
<
Map
<
String
,
Object
>>>
mapDatas
=
new
Linked
HashMap
<
String
,
List
<
Map
<
String
,
Object
>>>();
if
(
datas
!=
null
)
{
if
(
datas
!=
null
)
{
for
(
Map
<
String
,
Object
>
map
:
datas
)
{
for
(
Map
<
String
,
Object
>
map
:
datas
)
{
if
(
map
.
size
()
>
0
)
{
if
(
map
.
size
()
>
0
)
{
...
@@ -352,7 +353,7 @@ public class Util {
...
@@ -352,7 +353,7 @@ public class Util {
}
}
public
static
Map
<
String
,
List
<
Map
<
String
,
Object
>>>
listToML
(
List
<
Map
<
String
,
Object
>>
datas
,
String
bar
,
String
...
keyName
)
{
public
static
Map
<
String
,
List
<
Map
<
String
,
Object
>>>
listToML
(
List
<
Map
<
String
,
Object
>>
datas
,
String
bar
,
String
...
keyName
)
{
Map
<
String
,
List
<
Map
<
String
,
Object
>>>
mapDatas
=
new
HashMap
<
String
,
List
<
Map
<
String
,
Object
>>>();
Map
<
String
,
List
<
Map
<
String
,
Object
>>>
mapDatas
=
new
Linked
HashMap
<
String
,
List
<
Map
<
String
,
Object
>>>();
if
(
datas
!=
null
)
{
if
(
datas
!=
null
)
{
for
(
Map
<
String
,
Object
>
map
:
datas
)
{
for
(
Map
<
String
,
Object
>
map
:
datas
)
{
if
(
map
.
size
()
>
0
)
{
if
(
map
.
size
()
>
0
)
{
...
@@ -462,7 +463,7 @@ public class Util {
...
@@ -462,7 +463,7 @@ public class Util {
* @throws
* @throws
*/
*/
public
static
Map
<?,
?>
reMap
(
Map
<?,
?>
fromMap
)
{
public
static
Map
<?,
?>
reMap
(
Map
<?,
?>
fromMap
)
{
Map
<
Object
,
Object
>
map
=
new
HashMap
<
Object
,
Object
>();
Map
<
Object
,
Object
>
map
=
new
Linked
HashMap
<
Object
,
Object
>();
for
(
Object
key
:
fromMap
.
keySet
())
{
for
(
Object
key
:
fromMap
.
keySet
())
{
Object
obj
=
fromMap
.
get
(
key
);
Object
obj
=
fromMap
.
get
(
key
);
if
(
obj
instanceof
Map
)
{
if
(
obj
instanceof
Map
)
{
...
@@ -484,7 +485,7 @@ public class Util {
...
@@ -484,7 +485,7 @@ public class Util {
* @return
* @return
*/
*/
public
static
<
T
>
T
converArgs
(
Class
<
T
>
type
,
Map
<?,
?>
args
,
String
name
)
{
public
static
<
T
>
T
converArgs
(
Class
<
T
>
type
,
Map
<?,
?>
args
,
String
name
)
{
Map
<
String
,
String
[]>
map
=
new
HashMap
<
String
,
String
[]>();
Map
<
String
,
String
[]>
map
=
new
Linked
HashMap
<
String
,
String
[]>();
for
(
Object
arg_key
:
args
.
keySet
())
{
for
(
Object
arg_key
:
args
.
keySet
())
{
String
key
=
String
.
valueOf
(
arg_key
);
String
key
=
String
.
valueOf
(
arg_key
);
if
(
key
.
startsWith
(
name
+
"."
))
{
if
(
key
.
startsWith
(
name
+
"."
))
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment