com.rits.cloning.Immutable Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of cloning Show documentation
Show all versions of cloning Show documentation
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.
The newest version!
package com.rits.cloning;
import static java.lang.annotation.ElementType.TYPE;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
/**
* marks the specific class as immutable and the cloner avoids cloning it
*
* @author kostantinos.kougios
*
* 24 Mar 2011
*/
@Target(TYPE)
@Retention(RUNTIME)
public @interface Immutable
{
/**
* by default all subclasses of the @Immutable class are not immutable. This can override it.
* @return true for subclasses of @Immutable class to be regarded as immutable from the cloner
*/
boolean subClass() default false;
}