public class TypedCastUtil extends Object
| Constructor and Description |
|---|
TypedCastUtil() |
| Modifier and Type | Method and Description |
|---|---|
static <T> @NotNull Collection<T> |
castCollection(Collection<?> obj)
force to cast object in collection.
|
static <T> @NotNull Collection<T> |
castCollection(Collection<?> obj,
Class<T> claz)
type checking first, then cast type.
|
static <T> @NotNull List<T> |
castList(Collection<?> obj)
force to cast object in collection.
|
static <T> @NotNull List<T> |
castList(Collection<?> obj,
Class<T> claz)
type checking first, then cast type.
|
static <T> T |
castObject(Object obj)
force to cast object
|
static <T> T |
castObject(Object obj,
Class<T> claz)
type checking first, then cast type.
|
static <T> @NotNull Set<T> |
castSet(Collection<?> obj)
force to cast object in collection.
|
static <T> @NotNull Set<T> |
castSet(Collection<?> obj,
Class<T> claz)
type checking first, then cast type.
|
@Contract(value="!null->!null") public static <T> T castObject(Object obj)
ClassCastException - if type wrong.@Nullable public static <T> T castObject(Object obj, Class<T> claz)
@NotNull public static <T> @NotNull Collection<T> castCollection(Collection<?> obj)
ClassCastException - if type wrong.@NotNull public static <T> @NotNull Collection<T> castCollection(Collection<?> obj, Class<T> claz)
@NotNull public static <T> @NotNull List<T> castList(Collection<?> obj)
ClassCastException - if type wrong.@NotNull public static <T> @NotNull List<T> castList(Collection<?> obj, Class<T> claz)
@NotNull public static <T> @NotNull Set<T> castSet(Collection<?> obj)
ClassCastException - if type wrong.@NotNull public static <T> @NotNull Set<T> castSet(Collection<?> obj, Class<T> claz)
Copyright © 2023. All rights reserved.