.
This commit is contained in:
@@ -38,11 +38,13 @@ public final class FileKit {
|
||||
|
||||
/**
|
||||
* 拷贝文件/文件目录
|
||||
* @param source
|
||||
* @param target
|
||||
* @param linkPath
|
||||
* @param source 源文件目录
|
||||
* @param target 目标目录
|
||||
*/
|
||||
public static void copyFiles(File source, File target, String linkPath) {
|
||||
private static void copyFiles(File source, File target) {
|
||||
copyFiles(source, target, "");
|
||||
}
|
||||
private static void copyFiles(File source, File target, String linkPath) {
|
||||
if (source.isDirectory()){
|
||||
final String _linkPath = linkPath + File.separator+ source.getName();
|
||||
asList(source.listFiles()).forEach(f->{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package net.tccn.base;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.lang.reflect.Array;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
@@ -10,17 +10,59 @@ import java.util.stream.Stream;
|
||||
*/
|
||||
public class Liangs {
|
||||
|
||||
public static <T> Set<T> streamConcat(Stream<T> ... streams) {
|
||||
/**
|
||||
* 将集合数组合并到一个Set<T> 集合中
|
||||
* @param <T> 泛型
|
||||
* @param streams 集合数组
|
||||
* @return
|
||||
*/
|
||||
public static <T> Stream<T> concat(Stream<T> ... streams) {
|
||||
Stream<T> stream = Stream.empty();
|
||||
for (int i = 0; i < streams.length; i++) {
|
||||
stream = Stream.concat(stream, streams[i]);
|
||||
}
|
||||
return stream.collect(Collectors.toSet());
|
||||
return stream;
|
||||
}
|
||||
|
||||
/**
|
||||
* 将字符串第一个字母转大写
|
||||
* @param str 待转换字符串
|
||||
* @return
|
||||
*/
|
||||
public static String toUpperCaseFirst(String str) {
|
||||
Objects.requireNonNull(str);
|
||||
return str.substring(0, 1).toUpperCase() + str.substring(1);
|
||||
}
|
||||
|
||||
/**
|
||||
* 转化集合为数组,带泛型支持
|
||||
* @param values 集合
|
||||
* @param <T> 泛型
|
||||
* @return
|
||||
*/
|
||||
public static <T> T[] toArray(Collection<T> values) {
|
||||
if (values == null || values.size() == 0)
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
Class<?> clazz = null;
|
||||
for (T entity : values) {
|
||||
clazz = entity.getClass();
|
||||
break;
|
||||
}
|
||||
return values.toArray((T[]) Array.newInstance(clazz, values.size()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 转化集合为数组,带泛型支持
|
||||
* @param values 集合
|
||||
* @param <T> 泛型
|
||||
* @return
|
||||
*/
|
||||
public static <T> T[] toArray(Stream<T> values) {
|
||||
if (values == null || values.count() == 0)
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
|
||||
List<T> list = values.collect(Collectors.toList());
|
||||
return toArray(list);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -399,7 +399,7 @@ public final class MetaKit {
|
||||
Set<String> allAlias;
|
||||
|
||||
if (!all) {
|
||||
allAlias = Liangs.streamConcat(
|
||||
allAlias = Liangs.concat(
|
||||
metaService.getFilters().stream().map(f -> {
|
||||
String col = (String) f.getName();
|
||||
String alias = col.split("[.]")[0];
|
||||
@@ -408,7 +408,7 @@ public final class MetaKit {
|
||||
metaService.getExports().stream().map(x -> x.get("col").split("[.]")[0]),
|
||||
metaService.getShows().stream().map(x -> x.get("col").split("[.]")[0])/*, todo: xxx
|
||||
metaService.getEdits().stream().map(x -> x.split("[.]")[0])*/
|
||||
);
|
||||
).collect(Collectors.toSet());
|
||||
|
||||
} else {
|
||||
allAlias = new HashSet<>();
|
||||
|
||||
Reference in New Issue
Block a user