org.prevayler.contrib.facade
Class MethodNameTransactionTypeDeterminer

java.lang.Object
  extended by org.prevayler.contrib.facade.MethodNameTransactionTypeDeterminer
All Implemented Interfaces:
TransactionType.Determiner

public class MethodNameTransactionTypeDeterminer
extends Object
implements TransactionType.Determiner

This transaction type determiner uses a combination of heuristics to determine the proper transaction type (in the exact order given below):

  1. Methods returning void will be of type TransactionType.TRANSACTION unless the method name contains the word "[t|T]ransient", in which case it will be of type TransactionType.NOOP (see #3 for description)
  2. Methods starting with (or matching) the prefixes "fetch", "find", "get", and "retrieve" will be of type TransactionType.QUERY
  3. Methods that fall through check #2, and are all-lowercase, will be of type TransactionType.NOOP. This means Prevayler will not be invoked at all, which is useful for cases where a method on the interface such as "root()" provides unsynchronized access to the prevalent system for use by external query mechanisms. It also avoids double transactions if a transactional method calls the system access method.
  4. Methods that fall through check #3 will be of type TransactionType.TRANSACTION_WITH_QUERY

Since:
0_1
Author:
Jay Sachs [jay@contravariant.org], Jacob Kjome [hoju@visi.com]

Constructor Summary
MethodNameTransactionTypeDeterminer()
           
 
Method Summary
 TransactionType determineTransactionType(Method p_method)
          Given a Method, determine the appropriate TransactionType to be used in implemented a Prevayler for that method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MethodNameTransactionTypeDeterminer

public MethodNameTransactionTypeDeterminer()
Method Detail

determineTransactionType

public TransactionType determineTransactionType(Method p_method)
Description copied from interface: TransactionType.Determiner
Given a Method, determine the appropriate TransactionType to be used in implemented a Prevayler for that method.

Specified by:
determineTransactionType in interface TransactionType.Determiner
Parameters:
p_method - the Method in question
Returns:
the TransactionType appropriate for that method.


Copyright © 2001-2013. All Rights Reserved.