All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.openlca.util.Copy Maven / Gradle / Ivy

There is a newer version: 2.2.1
Show newest version
package org.openlca.util;

import org.openlca.core.model.Copyable;

public final class Copy {

	private Copy() {
	}

	/**
	 * A null-safe method for copying the given element. **NOTE:** this method
	 * only works if the copy method of T returns an instance or a sub-type of T.
	 */
	@SuppressWarnings("unchecked")
	public static > T of(T copyable) {
		return copyable == null
			? null
			: (T) copyable.copy();
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy