public <T> void emitInternal(Sensor<T> sensor, T val) { SubscriptionContext subsContext = getSubscriptionContext(); if (subsContext != null) subsContext.publish(sensor.newEvent(getProxyIfAvailable(), val)); }
/** * Adds the given entity as a child of this parent <em>and</em> sets this entity as the parent of the child; * returns argument passed in, for convenience. */ @Override public <T extends Entity> T addChild(T child) { checkNotNull(child, "child must not be null (for entity %s)", this); synchronized (children) { if (Entities.isAncestor(this, child)) throw new IllegalStateException("loop detected trying to add child "+child+" to "+this+"; it is already an ancestor"); child.setParent(getProxyIfAvailable()); children.add(child); getManagementSupport().getEntityChangeListener().onChildrenChanged(); } return child; }
suppliedParent.addChild(getProxyIfAvailable());
@Override public void clearParent() { if (parent.isNull()) return; Entity oldParent = parent.get(); parent.clear(); if (oldParent != null) oldParent.removeChild(getProxyIfAvailable()); }
entity.addChild(getProxyIfAvailable()); refreshInheritedConfig(); previouslyOwned = true;
if (entity.getParent()!=null) entity.getParent().removeChild(entity.getProxyIfAvailable());
parent = (parent instanceof AbstractEntity) ? ((AbstractEntity)parent).getProxyIfAvailable() : parent; entity.setParent(parent);