Skip to content

Method: addPostRegisterHandler(Consumer)

1: /**
2: * Copyright (C) 2020 Czech Technical University in Prague
3: *
4: * This program is free software: you can redistribute it and/or modify it under
5: * the terms of the GNU General Public License as published by the Free Software
6: * Foundation, either version 3 of the License, or (at your option) any
7: * later version.
8: *
9: * This program is distributed in the hope that it will be useful, but WITHOUT
10: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11: * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
12: * details. You should have received a copy of the GNU General Public License
13: * along with this program. If not, see <http://www.gnu.org/licenses/>.
14: */
15: package cz.cvut.kbss.jopa.sessions;
16:
17: import cz.cvut.kbss.jopa.model.descriptors.Descriptor;
18:
19: import java.util.ArrayList;
20: import java.util.Collections;
21: import java.util.List;
22: import java.util.Objects;
23: import java.util.function.Consumer;
24:
25: public class CloneConfiguration {
26:
27: private final Descriptor descriptor;
28:
29: private final List<Consumer<Object>> postRegister = new ArrayList<>(1);
30:
31: public CloneConfiguration(Descriptor descriptor) {
32: this.descriptor = Objects.requireNonNull(descriptor);
33: }
34:
35: public CloneConfiguration(Descriptor descriptor, List<Consumer<Object>> handlers) {
36: this.descriptor = Objects.requireNonNull(descriptor);
37: Objects.requireNonNull(handlers);
38: postRegister.addAll(handlers);
39: }
40:
41: public void addPostRegisterHandler(Consumer<Object> handler) {
42: postRegister.add(handler);
43: }
44:
45: public Descriptor getDescriptor() {
46: return descriptor;
47: }
48:
49: public List<Consumer<Object>> getPostRegister() {
50: return Collections.unmodifiableList(postRegister);
51: }
52: }