HONEYCOMB-359 - Wildcarded writers
[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 org.opendaylight.yangtools.yang.binding.DataObject;
20 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
21
22 import javax.annotation.Nonnull;
23 import java.util.Collection;
24 import java.util.Set;
25
26 /**
27  * Registry builder where {@link SubtreeManager}s can be added with or without relationships between them.
28  * The relationships express what the order of execution should be.
29  */
30 public interface ModifiableSubtreeManagerRegistryBuilder<S extends SubtreeManager<? extends DataObject>> {
31
32     /**
33      * Add a handler responsible for writing only a single complex node.
34      */
35     ModifiableSubtreeManagerRegistryBuilder<S> add(@Nonnull S handler);
36
37     /**
38      * Add a handler responsible for writing multiple complex nodes within a subtree its responsible for. Identifiers for
39      * subtree nodes handled by a single handler have to be relative from {@link DataObject} that represents subtree
40      * root.
41      */
42     ModifiableSubtreeManagerRegistryBuilder<S> subtreeAdd(@Nonnull Set<InstanceIdentifier<?>> handledChildren,
43                                                           @Nonnull S handler);
44
45     /**
46      * Add a handler responsible for writing all complex nodes within a subtree its responsible for.
47      */
48     ModifiableSubtreeManagerRegistryBuilder<S> wildcardedSubtreeAdd(@Nonnull S handler);
49
50     /**
51      * Add a handler and make sure it will be executed before handler identifier by relatedType is executed.
52      */
53     ModifiableSubtreeManagerRegistryBuilder<S> addBefore(@Nonnull S handler,
54                                                          @Nonnull InstanceIdentifier<?> relatedType);
55
56     ModifiableSubtreeManagerRegistryBuilder<S> addBefore(@Nonnull S handler,
57                                                          @Nonnull Collection<InstanceIdentifier<?>> relatedTypes);
58
59     ModifiableSubtreeManagerRegistryBuilder<S> wildcardedSubtreeAddBefore(@Nonnull S handler,
60                                                                           @Nonnull InstanceIdentifier<?> relatedType);
61
62     ModifiableSubtreeManagerRegistryBuilder<S> wildcardedSubtreeAddBefore(@Nonnull S handler,
63                                                                           @Nonnull Collection<InstanceIdentifier<?>> relatedTypes);
64
65     ModifiableSubtreeManagerRegistryBuilder<S> subtreeAddBefore(@Nonnull Set<InstanceIdentifier<?>> handledChildren,
66                                                                 @Nonnull S handler,
67                                                                 @Nonnull InstanceIdentifier<?> relatedType);
68
69     ModifiableSubtreeManagerRegistryBuilder<S> subtreeAddBefore(@Nonnull Set<InstanceIdentifier<?>> handledChildren,
70                                                                 @Nonnull S handler,
71                                                                 @Nonnull Collection<InstanceIdentifier<?>> relatedTypes);
72
73     /**
74      * Add a handler and make sure it will be executed after handler identifier by relatedType is executed.
75      */
76     ModifiableSubtreeManagerRegistryBuilder<S> addAfter(@Nonnull S handler,
77                                                         @Nonnull InstanceIdentifier<?> relatedType);
78
79     ModifiableSubtreeManagerRegistryBuilder<S> addAfter(@Nonnull S handler,
80                                                         @Nonnull Collection<InstanceIdentifier<?>> relatedTypes);
81
82     ModifiableSubtreeManagerRegistryBuilder<S> wildcardedSubtreeAddAfter(@Nonnull S handler,
83                                                                          @Nonnull InstanceIdentifier<?> relatedType);
84
85     ModifiableSubtreeManagerRegistryBuilder<S> wildcardedSubtreeAddAfter(@Nonnull S handler,
86                                                                          @Nonnull Collection<InstanceIdentifier<?>> relatedTypes);
87
88     ModifiableSubtreeManagerRegistryBuilder<S> subtreeAddAfter(@Nonnull Set<InstanceIdentifier<?>> handledChildren,
89                                                                @Nonnull S handler,
90                                                                @Nonnull InstanceIdentifier<?> relatedType);
91
92     ModifiableSubtreeManagerRegistryBuilder<S> subtreeAddAfter(@Nonnull Set<InstanceIdentifier<?>> handledChildren,
93                                                                @Nonnull S handler,
94                                                                @Nonnull Collection<InstanceIdentifier<?>> relatedTypes);
95 }