Package org.jboss.resteasy.core
Class ResteasyContext
- java.lang.Object
-
- org.jboss.resteasy.core.ResteasyContext
-
public final class ResteasyContext extends Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceResteasyContext.CloseableContext
-
Constructor Summary
Constructors Constructor Description ResteasyContext()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static ResteasyContext.CloseableContextaddCloseableContextDataLevel()static ResteasyContext.CloseableContextaddCloseableContextDataLevel(Map<Class<?>,Object> data)static Map<Class<?>,Object>addContextDataLevel()static voidclearContextData()static <T> TcomputeIfAbsent(Class<T> type, Supplier<T> newValue)Gets the current context for the type.static <T> TgetContextData(Class<T> type)static intgetContextDataLevelCount()static Map<Class<?>,Object>getContextDataMap()static Map<Class<?>,Object>getContextDataMap(boolean create)static <T> TgetRequiredContextData(Class<T> type)Gets the current context for the type.static <T> TpopContextData(Class<T> type)static <T> voidpushContext(Class<T> type, T data)static voidpushContextDataMap(Map<Class<?>,Object> map)static voidremoveContextDataLevel()static ObjectsearchContextData(Object o)
-
-
-
Method Detail
-
pushContext
public static <T> void pushContext(Class<T> type, T data)
-
getContextData
public static <T> T getContextData(Class<T> type)
-
getRequiredContextData
public static <T> T getRequiredContextData(Class<T> type)
Gets the current context for the type. If not found in the current context a IllegalArgumentException is thrown.- Type Parameters:
T- the type of the lookup- Parameters:
type- the type to lookup in the context map- Returns:
- the context data
- Throws:
IllegalArgumentException- if the type is not found in the current context
-
computeIfAbsent
public static <T> T computeIfAbsent(Class<T> type, Supplier<T> newValue)
Gets the current context for the type. If the context does not exist the value is resolved from thenewValuesupplier and pushed to the current context.- Type Parameters:
T- the type to lookup- Parameters:
type- the type to lookup in the context mapnewValue- the new value if the value was not already setup in the value map- Returns:
- the context data
-
popContextData
public static <T> T popContextData(Class<T> type)
-
clearContextData
public static void clearContextData()
-
addCloseableContextDataLevel
public static ResteasyContext.CloseableContext addCloseableContextDataLevel()
-
addCloseableContextDataLevel
public static ResteasyContext.CloseableContext addCloseableContextDataLevel(Map<Class<?>,Object> data)
-
getContextDataLevelCount
public static int getContextDataLevelCount()
-
removeContextDataLevel
public static void removeContextDataLevel()
-
-