com.googlecode.objectify.Key.getRoot()方法的使用及代码示例

x33g5p2x  于2022-01-23 转载在 其他  
字(1.1k)|赞(0)|评价(0)|浏览(75)

本文整理了Java中com.googlecode.objectify.Key.getRoot()方法的一些代码示例,展示了Key.getRoot()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Key.getRoot()方法的具体详情如下:
包路径:com.googlecode.objectify.Key
类名称:Key
方法名:getRoot

Key.getRoot介绍

[英]Gets the root of a parent graph of keys. If a Key has no parent, it is the root.
[中]获取键的父图形的根。如果键没有父项,则它是根。

代码示例

代码示例来源:origin: objectify/objectify

/**
 * Gets the root of a parent graph of keys.  If a Key has no parent, it is the root.
 *
 * @return the topmost parent key, or this object itself if it is the root.
 * Note that the root key could potentially have any type.
 */
@SuppressWarnings("unchecked")
public <V> Key<V> getRoot() {
  if (this.getParent() == null)
    return (Key<V>)this;
  else
    return this.getParent().getRoot();
}

代码示例来源:origin: com.googlecode.cedar-common/objectify

/**
 * Gets the root of a parent graph of keys.  If a Key has no parent, it is the root.
 *  
 * @return the topmost parent key, or this object itself if it is the root.
 * Note that the root key could potentially have any type. 
 */
@SuppressWarnings("unchecked")
public <V> Key<V> getRoot()
{
  if (this.getParent() == null)
    return (Key<V>)this;
  else
    return this.getParent().getRoot();
}

相关文章