org.apache.brooklyn.core.entity.Entities.descendantsWithoutSelf()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(3.2k)|赞(0)|评价(0)|浏览(100)

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

Entities.descendantsWithoutSelf介绍

[英]Returns the entity's children, its children's children, and so on.
[中]返回实体的子对象及其子对象的子对象,依此类推。

代码示例

代码示例来源:origin: org.apache.brooklyn/brooklyn-core

/**
 * Returns the entity's children, its children's children, and so on.
 *
 * @see #descendants(Entity, Predicate, boolean)
 */
public static Iterable<Entity> descendantsWithoutSelf(Entity root) {
  Set<Entity> result = Sets.newLinkedHashSet();
  descendantsWithoutSelf(root, result);
  return result;
}

代码示例来源:origin: org.apache.brooklyn/brooklyn-core

/**
 * Returns the entity, its children, and all its children, and so on.
 *
 * @see #descendants(Entity, Predicate, boolean)
 */
public static Iterable<Entity> descendantsAndSelf(Entity root) {
  Set<Entity> result = Sets.newLinkedHashSet();
  result.add(root);
  descendantsWithoutSelf(root, result);
  return result;
}

代码示例来源:origin: org.apache.brooklyn/brooklyn-core

private enum ValueMarkers {
  UNCHANGED,
  REMOVE;
}

代码示例来源:origin: org.apache.brooklyn/brooklyn-rest-resources

@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
public void setFromMap(String application, String entityToken, Boolean recurse, Map newValues) {
  final Entity entity = brooklyn().getEntity(application, entityToken);
  if (!Entitlements.isEntitled(mgmt().getEntitlementManager(), Entitlements.MODIFY_ENTITY, entity)) {
    throw WebResourceUtils.forbidden("User '%s' is not authorized to modify entity '%s'",
        Entitlements.getEntitlementContext().user(), entity);
  }
  if (LOG.isDebugEnabled())
    LOG.debug("REST user " + Entitlements.getEntitlementContext() + " setting configs " + newValues);
  for (Object entry : newValues.entrySet()) {
    String configName = Strings.toString(((Map.Entry) entry).getKey());
    Object newValue = ((Map.Entry) entry).getValue();
    ConfigKey ck = findConfig(entity, configName);
    ((EntityInternal) entity).config().set(ck, TypeCoercions.coerce(newValue, ck.getTypeToken()));
    if (Boolean.TRUE.equals(recurse)) {
      for (Entity e2 : Entities.descendantsWithoutSelf(entity)) {
        ((EntityInternal) e2).config().set(ck, newValue);
      }
    }
  }
}

代码示例来源:origin: org.apache.brooklyn/brooklyn-rest-resources

@SuppressWarnings({ "rawtypes", "unchecked" })
  @Override
  public void set(String application, String entityToken, String configName, Boolean recurse, Object newValue) {
    final Entity entity = brooklyn().getEntity(application, entityToken);
    if (!Entitlements.isEntitled(mgmt().getEntitlementManager(), Entitlements.MODIFY_ENTITY, entity)) {
      throw WebResourceUtils.forbidden("User '%s' is not authorized to modify entity '%s'",
          Entitlements.getEntitlementContext().user(), entity);
    }

    ConfigKey ck = findConfig(entity, configName);
    LOG.debug("REST setting config " + configName + " on " + entity + " to " + newValue);
    ((EntityInternal) entity).config().set(ck, TypeCoercions.coerce(newValue, ck.getTypeToken()));
    if (Boolean.TRUE.equals(recurse)) {
      for (Entity e2 : Entities.descendantsWithoutSelf(entity)) {
        ((EntityInternal) e2).config().set(ck, newValue);
      }
    }
  }
}

相关文章