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

net.sf.gluebooster.java.booster.basic.container.CopyBoostUtils Maven / Gradle / Ivy

package net.sf.gluebooster.java.booster.basic.container;

import java.util.Map;

import net.sf.gluebooster.java.booster.basic.transformation.CallableByCopying;
import net.sf.gluebooster.java.booster.essentials.meta.HasAttributes;

/**
 * Utilities for copying.
 * 
 * @author cbauer
 * @defaultParamText source the source to copy from
 * @defaultParamText target the targets to copy to
 * @defaultParamText keys the keys which values are to be copied
 *
 */
public class CopyBoostUtils {

	/**
	 * Does the copying
	 */
	private static CallableByCopying copier = new CallableByCopying();

	/**
	 * Copies some attributes from a source to a target
	 */
	public static void copyAttributes(HasAttributes source, HasAttributes target, Object... keys) throws Exception {
		copier.call(source, target, keys);
		// for (Object key : keys) {
		// target.setAttribute(key, source.getAttribute(key));
		// }
	}

	/**
	 * Copies some entries from a source to a target
	 */
	public static void copyEntries(Map source, Map target, Object... keys) throws Exception {
		copier.call(source, target, keys);

		// for (Object key : keys) {
		// target.put(key, source.get(key));
		// }
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy