4e6b2d8058e18c13e4fdde50881a0f0f54a00659
[honeycomb.git] / infra / translate-api / src / main / java / io / fd / honeycomb / translate / ModifiableSubtreeManagerRegistryBuilder.java
1 /*
2  * Copyright (c) 2016 Cisco and/or its affiliates.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at:
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 package io.fd.honeycomb.translate;
18
19 import java.util.Collection;
20 import java.util.Set;
21 import javax.annotation.Nonnull;
22 import org.opendaylight.yangtools.yang.binding.DataObject;
23 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
24
25 /**
26  * Registry builder where {@link SubtreeManager}s can be added with or without relationships between them.
27  * The relationships express what the order of execution should be.
28  */
29 public interface ModifiableSubtreeManagerRegistryBuilder<S extends SubtreeManager<? extends DataObject>> {
30
31     /**
32      * Add a handler responsible for writing only a single complex node.
33      */
34     ModifiableSubtreeManagerRegistryBuilder<S> add(@Nonnull S handler);
35
36     /**
37      * Add a handler responsible for writing multiple complex nodes within a subtree its responsible for. Identifiers for
38      * subtree nodes handled by a single handler have to be relative from {@link DataObject} that represents subtree
39      * root.
40      */
41     ModifiableSubtreeManagerRegistryBuilder<S> subtreeAdd(@Nonnull Set<InstanceIdentifier<?>> handledChildren,
42                                                           @Nonnull S handler);
43
44     /**
45      * Add a handler and make sure it will be executed before handler identifier by relatedType is executed.
46      */
47     ModifiableSubtreeManagerRegistryBuilder<S> addBefore(@Nonnull S handler,
48                                                          @Nonnull InstanceIdentifier<?> relatedType);
49
50     ModifiableSubtreeManagerRegistryBuilder<S> addBefore(@Nonnull S handler,
51                                                          @Nonnull Collection<InstanceIdentifier<?>> relatedTypes);
52
53     ModifiableSubtreeManagerRegistryBuilder<S> subtreeAddBefore(@Nonnull Set<InstanceIdentifier<?>> handledChildren,
54                                                                 @Nonnull S handler,
55                                                                 @Nonnull InstanceIdentifier<?> relatedType);
56
57     ModifiableSubtreeManagerRegistryBuilder<S> subtreeAddBefore(@Nonnull Set<InstanceIdentifier<?>> handledChildren,
58                                                                 @Nonnull S handler,
59                                                                 @Nonnull Collection<InstanceIdentifier<?>> relatedTypes);
60
61     /**
62      * Add a handler and make sure it will be executed after handler identifier by relatedType is executed.
63      */
64     ModifiableSubtreeManagerRegistryBuilder<S> addAfter(@Nonnull S handler,
65                                                         @Nonnull InstanceIdentifier<?> relatedType);
66
67     ModifiableSubtreeManagerRegistryBuilder<S> addAfter(@Nonnull S handler,
68                                                         @Nonnull Collection<InstanceIdentifier<?>> relatedTypes);
69
70     ModifiableSubtreeManagerRegistryBuilder<S> subtreeAddAfter(@Nonnull Set<InstanceIdentifier<?>> handledChildren,
71                                                                @Nonnull S handler,
72                                                                @Nonnull InstanceIdentifier<?> relatedType);
73
74     ModifiableSubtreeManagerRegistryBuilder<S> subtreeAddAfter(@Nonnull Set<InstanceIdentifier<?>> handledChildren,
75                                                                @Nonnull S handler,
76                                                                @Nonnull Collection<InstanceIdentifier<?>> relatedTypes);
77 }