Do not pretty-print body class
[yangtools.git] / yang / yang-data-api / src / main / java / org / opendaylight / yangtools / yang / data / api / schema / tree / DataTreeFactory.java
1 /*
2  * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package org.opendaylight.yangtools.yang.data.api.schema.tree;
9
10 import org.eclipse.jdt.annotation.NonNull;
11 import org.opendaylight.yangtools.yang.data.api.schema.DistinctNodeContainer;
12 import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
13
14 /**
15  * Factory interface for creating data trees.
16  */
17 public interface DataTreeFactory {
18     /**
19      * Create a new data tree based on specified configuration, with a best-guess root. Use this method only if you
20      * do not have a corresponding SchemaContext handy. Mandatory nodes whose enforcement point is the root node will
21      * not be enforced even if some are present in the SchemaContext and validation is requested in configuration.
22      *
23      * <p>
24      * Correctness note: this method may not accurately initialize the root node in certain non-root scenarios due to
25      * the impossibility to accurately derive root type from plain YangInstanceIdentifier. Using
26      * {@link #create(DataTreeConfiguration, EffectiveModelContext)} is recommended, as it does not suffer from this
27      * shortcoming.
28      *
29      * @param treeConfig
30      *          Tree configuration.
31      * @return A data tree instance.
32      * @throws NullPointerException if treeConfig is null
33      */
34     @NonNull DataTree create(DataTreeConfiguration treeConfig);
35
36     /**
37      * Create a new data tree based on specified configuration, with a root node derived from the schema context lookup
38      * of the configuration. Mandatory nodes whose enforcement point is the root node will not be enforced even if some
39      * are present in the SchemaContext and validation is requested in configuration.
40      *
41      * @param treeConfig
42      *          Tree configuration.
43      * @return A data tree instance.
44      * @throws NullPointerException if any of the arguments are null
45      * @throws IllegalArgumentException if tree configuration does not match the SchemaContext, for example by root path
46      *                                  referring to a node which does not exist in the SchemaContext
47      */
48     @NonNull DataTree create(DataTreeConfiguration treeConfig, EffectiveModelContext initialSchemaContext);
49
50     /**
51      * Create a new data tree based on specified configuration, with the specified node.
52      *
53      * @param treeConfig
54      *          Tree configuration.
55      * @return A data tree instance.
56      * @throws DataValidationFailedException if initial root is not valid according to the schema context
57      * @throws NullPointerException if any of the arguments are null
58      * @throws IllegalArgumentException if a mismatch between the arguments is detected
59      */
60     @NonNull DataTree create(DataTreeConfiguration treeConfig, EffectiveModelContext initialSchemaContext,
61             DistinctNodeContainer<?, ?> initialRoot) throws DataValidationFailedException;
62 }