2 * Copyright (c) 2014 Cisco Systems, Inc. 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.concepts;
11 * An extension of the {@link Builder} concept which allows an implementation
12 * of this interface to be used in collections instead of the product. Given
13 * the mutable nature of Builders, this has to be done very carefully.
15 * @param <P> Product type
17 public interface ProductAwareBuilder<P> extends Builder<P> {
19 * Return the hash code of the product. This has to be equivalent
20 * of calling {@link #toInstance()}.{@link #hashCode()}.
22 * @return the hash code of the product.
24 int productHashCode();
27 * Check whether an instance of the product that would be created
28 * by the builder is equal to an existing instance. This has to
29 * be equivalent of calling {@link #toInstance()}.{@link #equals(Object)}.
31 * @param product Product instance
32 * @return Return true if the product is equal to the would-be
33 * product of the builder.
35 boolean productEquals(Object product);