/*
 * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
 *
 * This program and the accompanying materials are made available under the
 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
 * and is available at http://www.eclipse.org/legal/epl-v10.html
 */

package org.opendaylight.protocol.bgp.openconfig.impl.comparator;

import com.google.common.collect.ImmutableMap;
import org.opendaylight.protocol.bgp.openconfig.impl.spi.OpenConfigComparator;
import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbors.Neighbor;
import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.top.Bgp;
import org.opendaylight.yangtools.yang.binding.DataObject;

public final class OpenConfigComparatorFactory {

    private static final ImmutableMap<Class<?>, OpenConfigComparator<? extends DataObject>> COMPARATORS = ImmutableMap.<Class<?>, OpenConfigComparator<? extends DataObject>>builder()
            .put(Bgp.class, new GlobalComparator())
            .put(Neighbor.class, new NeighborComparator())
            .build();

    public static <T extends DataObject> OpenConfigComparator<T> getComparator(final Class<T> clazz) {
        return (OpenConfigComparator<T>) COMPARATORS.get(clazz);
    }

}

/*
 * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
 *
 * This program and the accompanying materials are made available under the
 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
 * and is available at http://www.eclipse.org/legal/epl-v10.html
 */

package org.opendaylight.protocol.bgp.openconfig.impl.comparator;

import com.google.common.collect.ImmutableMap;
import org.opendaylight.protocol.bgp.openconfig.impl.spi.OpenConfigComparator;
import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbors.Neighbor;
import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.top.Bgp;
import org.opendaylight.yangtools.yang.binding.DataObject;

public final class OpenConfigComparatorFactory {
    private OpenConfigComparatorFactory() {
        throw new UnsupportedOperationException();
    }

    private static final ImmutableMap<Class<?>, OpenConfigComparator<? extends DataObject>> COMPARATORS = ImmutableMap.<Class<?>, OpenConfigComparator<? extends DataObject>>builder()
            .put(Bgp.class, new GlobalComparator())
            .put(Neighbor.class, new NeighborComparator())
            .build();

    public static <T extends DataObject> OpenConfigComparator<T> getComparator(final Class<T> clazz) {
        return (OpenConfigComparator<T>) COMPARATORS.get(clazz);
    }

}

Add a private constructor to hide the implicit public one
Add a private constructor to hide the implicit public one

Add a private constructor to hide the implicit public one on
OpenConfigComparatorFactory.

Change-Id: Id24e1b3bb8c59e0eaed71093acd4443e75ac50db
Signed-off-by: Claudio D. Gasparini <3480fb4575078d890be8aed0007cb1d8785aa579@cisco.com>
