This commit is contained in:
Looly 2022-09-07 17:20:47 +08:00
parent a8a4f16bec
commit 2200701d7e
2 changed files with 29 additions and 3 deletions

View File

@ -7,10 +7,11 @@ import cn.hutool.core.collection.SetUtil;
import cn.hutool.core.convert.Convert;
import cn.hutool.core.exceptions.CloneRuntimeException;
import cn.hutool.core.lang.Assert;
import cn.hutool.core.lang.func.SerSupplier;
import cn.hutool.core.lang.func.LambdaUtil;
import cn.hutool.core.lang.func.SerSupplier;
import cn.hutool.core.lang.getter.BasicTypeGetter;
import java.lang.reflect.Type;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.sql.Time;
@ -564,7 +565,7 @@ public class Dict extends CustomKeyMap<String, Object> implements BasicTypeGette
* @see BeanPath#get(Object)
* @since 5.7.14
*/
public <T> T getByPath(final String expression, final Class<T> resultType) {
public <T> T getByPath(final String expression, final Type resultType) {
return Convert.convert(resultType, getByPath(expression));
}
// -------------------------------------------------------------------- Get end
@ -573,7 +574,7 @@ public class Dict extends CustomKeyMap<String, Object> implements BasicTypeGette
public Dict clone() {
try {
return (Dict) super.clone();
} catch (CloneNotSupportedException e) {
} catch (final CloneNotSupportedException e) {
throw new CloneRuntimeException(e);
}
}

View File

@ -0,0 +1,25 @@
package cn.hutool.core.text.dfa;
import org.junit.Assert;
import org.junit.Test;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
public class issueI5Q4HDTest {
@Test
public void matchAllTest(){
final String content="站房建设面积较小不符合规范要求。辅助设施_站房_面积";
final String keywordStr="不符合规范要求,现场手工比对孔不规范,采样口,现场,辅助设施,比对孔未处于监测断面下游,站房,未设置,标识,给排水,面积较小,监控设备,灭火装置,排污口,设备操作维护不方便,不规范,采样平台,参比方法,直爬梯,单独,站房建设,不健全,没有配置";
final List<String> keyWords = Arrays.asList(keywordStr.split(","));
final Set<String> keyWordSet=new HashSet<>(keyWords);
final WordTree wordTree=new WordTree();
wordTree.addWords(keyWordSet);
//DateUtil.beginOfHour()
final List<String> strings = wordTree.matchAll(content, -1, true, true);
Assert.assertEquals("[站房, 站房建设, 面积较小, 不符合规范要求, 辅助设施, 站房]", strings.toString());
}
}