本文整理汇总了Java中org.red5.server.api.scope.IScope.hasParent方法的典型用法代码示例。如果您正苦于以下问题:Java IScope.hasParent方法的具体用法?Java IScope.hasParent怎么用?Java IScope.hasParent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.red5.server.api.scope.IScope
的用法示例。
在下文中一共展示了IScope.hasParent方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: resolveScope
import org.red5.server.api.scope.IScope; //导入方法依赖的package包/类
/**
* Resolves scope for specified scope and path.
*
* @param from
* Scope to use as context (to start from)
* @param path
* Path to resolve
* @return Resolved scope
*/
public static IScope resolveScope(IScope from, String path) {
log.debug("resolveScope from: {} path: {}", from.getName(), path);
IScope current = from;
if (path.startsWith(SLASH)) {
current = ScopeUtils.findRoot(current);
path = path.substring(1, path.length());
}
if (path.endsWith(SLASH)) {
path = path.substring(0, path.length() - 1);
}
log.trace("Current: {}", current);
String[] parts = path.split(SLASH);
if (log.isTraceEnabled()) {
log.trace("Parts: {}", Arrays.toString(parts));
}
for (String part : parts) {
log.trace("Part: {}", part);
if (part.equals(".")) {
continue;
}
if (part.equals("..")) {
if (!current.hasParent()) {
return null;
}
current = current.getParent();
continue;
}
if (!current.hasChildScope(part)) {
return null;
}
current = current.getScope(part);
log.trace("Current: {}", current);
}
return current;
}
示例2: findRoot
import org.red5.server.api.scope.IScope; //导入方法依赖的package包/类
/**
* Finds root scope for specified scope object. Root scope is the top level scope among scope's parents.
*
* @param from
* Scope to find root for
* @return Root scope object
*/
public static IScope findRoot(IScope from) {
IScope current = from;
while (current.hasParent()) {
current = current.getParent();
}
return current;
}
示例3: findApplication
import org.red5.server.api.scope.IScope; //导入方法依赖的package包/类
/**
* Returns the application scope for specified scope. Application scope has depth of 1 and has no parent.
*
* See
*
* <pre>
* isApp
* </pre>
*
* method for details.
*
* @param from
* Scope to find application for
* @return Application scope.
*/
public static IScope findApplication(IScope from) {
IScope current = from;
while (current.hasParent() && !current.getType().equals(ScopeType.APPLICATION)) {
current = current.getParent();
}
return current;
}