-
- All Implemented Interfaces:
-
icu.windea.breezeframework.core.component.Component,icu.windea.breezeframework.core.component.PathPattern
public class PathPattern.AntPath extends PathPattern.AbstractPathPattern
Ant路径。
规则:
以
/作为分隔符。?匹配任意单个字符。*匹配除了分隔符之外的任意数量的任意字符。**匹配任意数量的任意字符。{name}匹配任意项,并命名为name。index匹配索引index,index是整数。name匹配名字、键name。
-
-
Field Summary
Fields Modifier and Type Field Description public final static PathPattern.AntPathINSTANCE
-
Method Summary
Modifier and Type Method Description Booleanmatches(String value, String path)判断指定的字符串是否匹配指定的路径。 Map<String, String>resolveVariables(String value, String path)解析路径变量。如果路径不匹配,则返回空结果。 <T extends Any> List<T>query(Object value, String path)根据指定路径查询查询对象,返回查询结果列表。 如果指定路径为空路径,则返回查询对象的单例列表。 <T extends Any> TgetOrNull(Object value, String path)根据指定路径查询查询对象,得到首个匹配的值,或者返回null。 如果指定路径为空路径,则返回查询对象本身。 <T extends Any> TgetOrElse(Object value, String path, Function0<T> defaultValue)根据指定路径查询查询对象,得到首个匹配的值,或者返回默认值。 如果指定路径为空路径,则返回查询对象本身。 -
Methods inherited from class icu.windea.breezeframework.core.component.PathPattern.AntPath
get, getOrDefault, joinToString, joinToString, joinToString, normalize, split, splitToSequence -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Method Detail
-
resolveVariables
Map<String, String> resolveVariables(String value, String path)
解析路径变量。如果路径不匹配,则返回空结果。
-
query
<T extends Any> List<T> query(Object value, String path)
根据指定路径查询查询对象,返回查询结果列表。 如果指定路径为空路径,则返回查询对象的单例列表。
-
getOrNull
<T extends Any> T getOrNull(Object value, String path)
根据指定路径查询查询对象,得到首个匹配的值,或者返回null。 如果指定路径为空路径,则返回查询对象本身。
-
-
-
-