org.eclipse.ditto.internal.utils.cluster.ManifestProvider Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ditto-internal-utils-cluster Show documentation
Show all versions of ditto-internal-utils-cluster Show documentation
Eclipse Ditto is a framework for creating and managing digital twins in the IoT.
The newest version!
/*
* Copyright (c) 2017 Contributors to the Eclipse Foundation
*
* See the NOTICE file(s) distributed with this work for additional
* information regarding copyright ownership.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.eclipse.ditto.internal.utils.cluster;
import static org.eclipse.ditto.base.model.common.ConditionChecker.checkNotNull;
import java.util.function.Function;
import javax.annotation.concurrent.Immutable;
import org.eclipse.ditto.base.model.headers.WithManifest;
/**
* This function provides the manifest for a given Object. If the given object is {@code null}, a
* NullPointerException is thrown. Otherwise the algorithm for obtaining the manifest string from a given Object
* {@code o} is as follows:
*
*
* - is {@code o} an instance of {@link WithManifest} → {@link WithManifest#getManifest()},
* - else for the class of {@code o} → {@link Class#getSimpleName()}.
*
*/
@Immutable
final class ManifestProvider implements Function