public final class ObjectUtils extends Object
Modifier and Type | Class and Description |
---|---|
static class |
ObjectUtils.Immutability |
Modifier and Type | Method and Description |
---|---|
static <T> T[] |
addAll(T first,
T... additional) |
static @NotNull ClassCastException |
asCCE(Exception e) |
static <E> E |
convertTo(@Nullable Class<E> eClass,
@Nullable Object o) |
static void |
defaultObjectForInterface(ThrowingFunction<Class<?>,Class<?>,ClassNotFoundException> defaultObjectForInterface) |
static Object |
defaultValue(Class<?> type) |
static Class<?>[] |
getAllInterfaces(Object o) |
static void |
getAllInterfaces(Object o,
Function<Class<?>,Boolean> accumulator) |
static <E extends Enum<E>> |
getSingletonForEnum(Class<E> eClass) |
static void |
immutabile(Class<?> clazz,
boolean isImmutable) |
static <T> Class<T> |
implementationToUse(Class<T> tClass) |
static boolean |
isConcreteClass(@NotNull Class<?> tClass) |
static boolean |
isFalse(CharSequence s) |
static ObjectUtils.Immutability |
isImmutable(@NotNull Class<?> clazz) |
static boolean |
isTrue(CharSequence s) |
static boolean |
matchingClass(@NotNull Class<?> base,
@NotNull Class<?> toMatch) |
static <T> T |
newInstance(@NotNull Class<T> clazz) |
static <T> T |
newInstance(@NotNull String className) |
static @Nullable Object |
newInstanceOrNull(Class<?> type) |
static <T> T |
onMethodCall(@NotNull BiFunction<Method,Object[],Object> biFunction,
@NotNull Class<T> tClass,
Class<?>... additional) |
static Class |
primToWrapper(Class<?> eClass)
If the class is a primitive type, change it to the equivalent wrapper.
|
static Object |
readResolve(@NotNull Object o) |
static <T> T |
requireNonNull(T o)
Standard mechanism to determine objects as not null.
|
static @Nullable Boolean |
toBoolean(@Nullable String s) |
static <E extends Enum<E>> |
valueOfIgnoreCase(@NotNull Class<E> eClass,
@NotNull String name) |
public static void immutabile(Class<?> clazz, boolean isImmutable)
public static ObjectUtils.Immutability isImmutable(@NotNull @NotNull Class<?> clazz)
public static boolean isTrue(CharSequence s)
public static boolean isFalse(CharSequence s)
public static Class primToWrapper(Class<?> eClass)
eClass
- to check@Nullable public static <E> E convertTo(@Nullable @Nullable Class<E> eClass, @Nullable @Nullable Object o) throws ClassCastException, IllegalArgumentException
@NotNull public static <E extends Enum<E>> E valueOfIgnoreCase(@NotNull @NotNull Class<E> eClass, @NotNull @NotNull String name)
@NotNull public static @NotNull ClassCastException asCCE(Exception e)
@NotNull public static <T> T newInstance(@NotNull @NotNull String className)
@NotNull public static <T> T newInstance(@NotNull @NotNull Class<T> clazz)
public static <T> T[] addAll(@NotNull T first, @NotNull T... additional)
public static boolean matchingClass(@NotNull @NotNull Class<?> base, @NotNull @NotNull Class<?> toMatch)
@NotNull public static <T> T onMethodCall(@NotNull @NotNull BiFunction<Method,Object[],Object> biFunction, @NotNull @NotNull Class<T> tClass, Class<?>... additional) throws IllegalArgumentException
IllegalArgumentException
public static boolean isConcreteClass(@NotNull @NotNull Class<?> tClass)
public static void getAllInterfaces(Object o, Function<Class<?>,Boolean> accumulator) throws IllegalArgumentException
IllegalArgumentException
public static void defaultObjectForInterface(ThrowingFunction<Class<?>,Class<?>,ClassNotFoundException> defaultObjectForInterface)
public static <T> T requireNonNull(@NotNull T o)
Objects.requireNonNull(Object)
and also decorated with NotNull
so that IntelliJ and other static analysis tools can work their magic.o
- reference to check for nullityNullPointerException
- if o is null
Copyright © 2022. All rights reserved.