/** * Creates a new instance of {@code XMLPropertyConfiguration} with the given * root node. * * @param root the root node */ XMLPropertyListConfiguration(final ImmutableNode root) { super(new InMemoryNodeModel(root)); }
/** * Creates a new instance of {@code PropertyListConfiguration} with the * given root node. * * @param root the root node */ PropertyListConfiguration(final ImmutableNode root) { super(new InMemoryNodeModel(root)); }
/** * Creates the {@code NodeModel} for this configuration based on a passed in * source configuration. This implementation creates an * {@link InMemoryNodeModel}. If the passed in source configuration is * defined, its root node also becomes the root node of this configuration. * Otherwise, a new, empty root node is used. * * @param c the configuration that is to be copied * @return the {@code NodeModel} for the new configuration */ private static NodeModel<ImmutableNode> createNodeModel( final HierarchicalConfiguration<ImmutableNode> c) { final ImmutableNode root = (c != null) ? obtainRootNode(c) : null; return new InMemoryNodeModel(root); }
/** * Returns an initialized sub configuration for this configuration that is * based on another {@code BaseHierarchicalConfiguration}. Thus, it is * independent from this configuration. * * @param node the root node for the sub configuration * @return the initialized sub configuration */ private BaseHierarchicalConfiguration createIndependentSubConfigurationForNode( final ImmutableNode node) { final BaseHierarchicalConfiguration sub = new BaseHierarchicalConfiguration(new InMemoryNodeModel(node)); initSubConfiguration(sub); return sub; }
/** * Returns an instance with the detached flag set to true. This method * is called if the selector of a tracked node does not match a single * node any more. It is possible to pass in a new node instance which * becomes the current tracked node. If this is <b>null</b>, the * previous node instance is used. * * @param newNode the new tracked node instance (may be <b>null</b>) * @return the updated instance */ public TrackedNodeData detach(final ImmutableNode newNode) { final ImmutableNode newTrackedNode = (newNode != null) ? newNode : getNode(); return new TrackedNodeData(newTrackedNode, observerCount, new InMemoryNodeModel(newTrackedNode)); } }
/** * Creates a sub configuration from the specified key which is independent * on this configuration. This means that the sub configuration operates on * a separate node model (although the nodes are initially shared). * * @param key the key of the sub configuration * @return the new sub configuration */ private BaseHierarchicalConfiguration createIndependentSubConfiguration( final String key) { final List<ImmutableNode> targetNodes = fetchFilteredNodeResults(key); final int size = targetNodes.size(); if (size != 1) { throw new ConfigurationRuntimeException( "Passed in key must select exactly one node (found %,d): %s", size, key); } final BaseHierarchicalConfiguration sub = new BaseHierarchicalConfiguration(new InMemoryNodeModel( targetNodes.get(0))); initSubConfiguration(sub); return sub; }
/** * {@inheritDoc} This implementation creates a new instance of * {@link InMemoryNodeModel}, initialized with this configuration's root * node. This has the effect that although the same nodes are used, the * original and copied configurations are independent on each other. */ @Override protected NodeModel<ImmutableNode> cloneNodeModel() { return new InMemoryNodeModel(getModel().getNodeHandler().getRootNode()); }
/** * {@inheritDoc} This implementation returns a newly created node model * with the correct root node set. Note that this model is not used for * property access, but only made available to clients that need to * operate on the node structure of this {@code SubnodeConfiguration}. * Be aware that the implementation of this method is not very efficient. */ @Override public InMemoryNodeModel getNodeModel() { final ImmutableNode root = getParent().getNodeModel().getTrackedNode(getRootSelector()); return new InMemoryNodeModel(root); }
new ImmutableNode.Builder().name(key) .value(config.getProperty(key)).create(); final InMemoryNodeModel tempModel = new InMemoryNodeModel(node); printNode(out, indentLevel + 1, node, tempModel.getNodeHandler()); out.println(";");