SimpleConfigurationNode getParentAttached() { SimpleConfigurationNode parent = this.parent; if (parent.isVirtual()) { parent = parent.getParentAttached().attachChildIfAbsent(parent); } return this.parent = parent; }
/** * The same as {@link #getParent()} - but ensuring that 'parent' is attached via * {@link #attachChildIfAbsent(SimpleConfigurationNode)}. * * @return The parent */ SimpleConfigurationNode getParentEnsureAttached() { SimpleConfigurationNode parent = this.parent; if (parent.isVirtual()) { parent = parent.getParentEnsureAttached().attachChildIfAbsent(parent); } return this.parent = parent; }
/** * The same as {@link #getParent()} - but ensuring that 'parent' is attached via * {@link #attachChildIfAbsent(SimpleConfigurationNode)}. * * @return The parent */ SimpleConfigurationNode getParentEnsureAttached() { SimpleConfigurationNode parent = this.parent; if (parent.isVirtual()) { parent = parent.getParentEnsureAttached().attachChildIfAbsent(parent); } return this.parent = parent; }
private SimpleConfigurationNode attachChildIfAbsent(SimpleConfigurationNode child) { if (isVirtual()) { throw new IllegalStateException("This parent is not currently attached. This is an internal state violation.");
protected void attachChild(SimpleConfigurationNode child) { if (isVirtual()) { throw new IllegalStateException("This parent is not currently attached. This is an internal state violation."); } if (!child.getParentAttached().equals(this)) { throw new IllegalStateException("Child " + child + " path is not a direct parent of me (" + this + "), cannot attach"); } ConfigValue oldValue, newValue; synchronized (this) { newValue = oldValue = this.value; if (!(oldValue instanceof MapConfigValue)) { if (child.key instanceof Integer) { if (oldValue instanceof NullConfigValue) { newValue = new ListConfigValue(this); } else if (!(oldValue instanceof ListConfigValue)) { newValue = new ListConfigValue(this, oldValue.getValue()); } } else { newValue = new MapConfigValue(this); } } possiblyDetach(newValue.putChild(child.key, child)); value = newValue; } if (newValue != oldValue) { oldValue.clear(); } child.attached = true; }
if (isVirtual()) { throw new IllegalStateException("This parent is not currently attached. This is an internal state violation.");
if (isVirtual()) { throw new IllegalStateException("This parent is not currently attached. This is an internal state violation.");