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

js.transaction.Immutable Maven / Gradle / Ivy

The newest version!
package js.transaction;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * Mark transational class or method as immutable, that is, read-only transaction. {@literal @}Immutable annotation can
 * be applied to both classes and methods. If applied to class all transactional methods become immutable; this can be
 * overridden using {@link Mutable} annotation. Note that {@link Transactional} classes are by default mutable.
 * 

* {@literal @}Immutable annotation has meaning only on a transactional managed method. It is considered a bug if dare * to use immutable annotation on a non-transactional class or method. Finally, as result from sample code, immutable * annotation has no parameter. * *

 *  @Transactional
 *  class DaoImpl implements Dao {
 *      ...
 *      @Immutable
 *      public User getUserByLogin(Login login) {
 *      }
 *  }
 * 
* * In above sample all public DAO methods are transactional and by default mutable. Anyway, getUserByLogin * method is explicitly marked as immutable since it does not alter database content. * * @author Iulian Rotaru * @version final */ @Target( { ElementType.TYPE, ElementType.METHOD }) @Retention(RetentionPolicy.RUNTIME) public @interface Immutable { }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy