Package com.prowidesoftware.deprecation
Class DeprecationUtils
- java.lang.Object
-
- com.prowidesoftware.deprecation.DeprecationUtils
-
public class DeprecationUtils extends java.lang.Object
Helper API to implement the http://www.prowidesoftware.com/resources/deprecation-policy- Since:
- 7.8.9
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
DeprecationUtils.EnvironmentVariableKey
Keywords for the environment variablePW_DEPRECATED
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
PW_DEPRECATED
Environment variable used to switch off deprecation phase implementation
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
clearEnv()
Sets the environment variable PW_DEPRECATED to an empty string, meaning all flags corresponding to the deprecation phase will be active by default.static void
phase2(java.lang.Class clazz, java.lang.String method, java.lang.String message)
According to the deprecation policy this method implements the phase 2 which involves logging a warning and making a small pause in the execution thread.static void
phase3(java.lang.Class clazz, java.lang.String method, java.lang.String message)
According to the deprecation policy this method implements the phase 3 which involves throwing a runtime exception.static void
setEnv(DeprecationUtils.EnvironmentVariableKey... keys)
Helper hack to set the environment variable from Java.
-
-
-
Field Detail
-
PW_DEPRECATED
public static final java.lang.String PW_DEPRECATED
Environment variable used to switch off deprecation phase implementation- See Also:
- Constant Field Values
-
-
Method Detail
-
phase2
public static void phase2(java.lang.Class clazz, java.lang.String method, java.lang.String message)
According to the deprecation policy this method implements the phase 2 which involves logging a warning and making a small pause in the execution thread.- Parameters:
clazz
- deprecated classmethod
- name of deprecated methodmessage
- the log message
-
phase3
public static void phase3(java.lang.Class clazz, java.lang.String method, java.lang.String message)
According to the deprecation policy this method implements the phase 3 which involves throwing a runtime exception.- Parameters:
clazz
- deprecated classmethod
- name of deprecated methodmessage
- the log message
-
setEnv
public static void setEnv(DeprecationUtils.EnvironmentVariableKey... keys)
Helper hack to set the environment variable from Java.For example if all keys are passed as parameter, this will set the environment variable PW_DEPRECATED=nolog,nodelay,noexception
- Parameters:
keys
- the variables to set in the environment variable
-
clearEnv
public static void clearEnv()
Sets the environment variable PW_DEPRECATED to an empty string, meaning all flags corresponding to the deprecation phase will be active by default.
-
-