public final class ClassQueries
extends java.lang.Object
Various utility function queries on classes.
| Constructor and Description |
|---|
ClassQueries() |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
isThreadSafe(java.lang.Class<?> cls)
Query whether a class is marked as thread-safe.
|
static boolean |
isThreadSafe(java.lang.Object obj)
Query whether an object is thread-safe.
|
public static boolean isThreadSafe(@Nonnull
java.lang.Class<?> cls)
Query whether a class is marked as thread-safe. A class can be marked as thread-safe through applying one of the following annotations:
ShareableImmutableThreadSafeNote that the javax.concurrent annotations are not supported, as they do not have RUNTIME retention.
cls - The class.true if the class is marked as thread-safe.public static boolean isThreadSafe(java.lang.Object obj)
Query whether an object is thread-safe. This first checks for the MaybeThreadSafe interface; if that is not present, then it checks the class using isThreadSafe(Class).
obj - The object.true if the object is marked as thread-safe. Null objects are trivially considered to be thread-safe.