2 * Copyright (c) 2019 PANTHEON.tech, s.r.o. and others. All rights reserved.
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
8 package org.opendaylight.yangtools.yang.binding;
10 import com.google.common.annotations.Beta;
11 import org.eclipse.jdt.annotation.NonNull;
12 import org.opendaylight.yangtools.concepts.Immutable;
15 * An immutable view of data. Data representation identity is available through {@link #getObjectModel()} and the actual
16 * data is available through {@link #getData()}.
18 * @param <T> Data object model type
21 public interface OpaqueData<T> extends Immutable {
23 * Return the object model class, which identifies it.
25 * @return Object model class
27 @NonNull Class<T> getObjectModel();
30 * Return the data in associated object model.
32 * @return Data held in this object.
37 * The hash code of any {@link OpaqueData} instance is defined by the combination of its object model and the data
38 * it holds. This is inherently object-model-specific hence different OpaqueData defined by distinct object models
39 * will result in differing hash codes. This implies that node with differing object models cannot compare as equal.
40 * See {@link AbstractOpaqueData#hashCode()} for canonical implementation.
42 * @return a hash code value for this object.
48 * Compare this object to another object. The comparison needs to take into account {@link #getObjectModel()}
49 * first and then follow comparison on {@link #getData()}. For canonical algorithm please refer to
50 * {@link AbstractOpaqueData#equals(Object)}.
52 * @param obj the reference object with which to compare.
53 * @return {@code true} if this object is the same as the obj argument; {@code false} otherwise.
56 boolean equals(Object obj);