Use @Serial tag
[mdsal.git] / singleton-service / mdsal-singleton-dom-impl / src / test / java / org / opendaylight / mdsal / singleton / dom / impl / util / TestInstanceIdentifier.java
1 /*
2  * Copyright (c) 2016 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.mdsal.singleton.dom.impl.util;
9
10 import com.google.common.base.Preconditions;
11 import com.google.common.collect.ImmutableList;
12 import java.io.Serial;
13 import java.util.LinkedList;
14 import java.util.List;
15 import org.opendaylight.yangtools.concepts.HierarchicalIdentifier;
16
17 /**
18  * Test helper class. {@link HierarchicalIdentifier} for testing only.
19  */
20 public class TestInstanceIdentifier implements HierarchicalIdentifier<TestInstanceIdentifier> {
21     @Serial
22     private static final long serialVersionUID = 1L;
23
24     private final ImmutableList<String> path;
25
26     public TestInstanceIdentifier(final Iterable<? extends TestInstanceIdentifier> path) {
27         Preconditions.checkArgument(path != null);
28         final List<String> tiis = new LinkedList<>();
29         for (final TestInstanceIdentifier t : path) {
30             tiis.add(t.toString());
31         }
32         this.path = ImmutableList.copyOf(tiis);
33     }
34
35     TestInstanceIdentifier(final String path) {
36         this.path = ImmutableList.of(path);
37     }
38
39     @Override
40     public boolean contains(final TestInstanceIdentifier other) {
41         throw new UnsupportedOperationException();
42     }
43 }