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

com.rits.cloning.FastClonerCalendar Maven / Gradle / Ivy

Go to download

The cloning library is a small, open source (Apache licensed) Java library which deep-clones objects. The objects do not have to implement the Cloneable interface. Effectively, this library can clone ANY Java object. It can be used i.e. in cache implementations, if you don't want the cached object to be modified or whenever you want to create a deep copy of an object.

There is a newer version: 1.9.12
Show newest version
package com.rits.cloning;

import java.util.Calendar;
import java.util.GregorianCalendar;
import java.util.Map;
import java.util.TimeZone;

/**
 * @author kostantinos.kougios
 *
 * 21 May 2009
 */
public class FastClonerCalendar implements IFastCloner
{
    public Object clone(final Object t, final IDeepCloner cloner, final Map clones) {
		final GregorianCalendar gc = new GregorianCalendar();
		Calendar c = (Calendar) t;
		gc.setTimeInMillis(c.getTimeInMillis());
		gc.setTimeZone((TimeZone) c.getTimeZone().clone());
		return gc;
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy