org.javalid.core
Class ThreadState

java.lang.Object
  extended by org.javalid.core.ThreadState

public class ThreadState
extends java.lang.Object

This class maintains the state of current thread. Generally this is not needed, but for instance the validation implementation for ValidateMap requires this in order to know some extra information to continue its validation.

The class stores state in a threadlocal.

Since:
1.0
Version:
1.0
Author:
M.Reuvers

Constructor Summary
ThreadState()
           
 
Method Summary
static ValidatorCallInfo getValidateCallInfo()
          Returns ValidatorCallInfo associated with current thread, note it is set during a call to validateObject / validateProperty.
static void remove()
          Clean this thread local.
static void setValidateCallInfo(ValidatorCallInfo info)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ThreadState

public ThreadState()
Method Detail

setValidateCallInfo

public static void setValidateCallInfo(ValidatorCallInfo info)

getValidateCallInfo

public static ValidatorCallInfo getValidateCallInfo()
Returns ValidatorCallInfo associated with current thread, note it is set during a call to validateObject / validateProperty. When recursing the state is updated. Use the setValidateCallInfo to set again if needed.

WARNING: If you call validateObject / validateProperty after retrieving this instance, and then use this instance again you are in TROUBLE as the state is already updated again then. Thus: Make sure to clone this object first then!!! Or you will get invalid state and undetermined behavior!!!!

Returns:
ValidatoreCallInfo if available, null otherwise.

remove

public static void remove()
Clean this thread local. It will have its default value again next time.

Since:
1.1