Package it.tidalwave.util
Class AsExtensions
- java.lang.Object
-
- it.tidalwave.util.AsExtensions
-
public class AsExtensions extends java.lang.Object
An extension to be used with Lombok in order to provide "as" support to classes that don't implement theAs
interface. The typical usage is to retrofit legacy code. FIXME: this class doesn't cache - every as*() call instantiates new objects.- Author:
- Fabrizio Giudici
-
-
Constructor Summary
Constructors Constructor Description AsExtensions()
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static <T> T
as(java.lang.Object datum, As.Type<T> type)
static <T> T
as(java.lang.Object datum, java.lang.Class<T> roleType)
static <T> T
as(java.lang.Object datum, java.lang.Class<T> roleType, As.NotFoundBehaviour<T> notFoundBehaviour)
Deprecated.static <T> java.util.Collection<T>
asMany(java.lang.Object datum, As.Type<T> type)
static <T> java.util.Collection<T>
asMany(java.lang.Object datum, java.lang.Class<T> type)
static <T> java.util.Optional<T>
maybeAs(java.lang.Object datum, As.Type<T> type)
static <T> java.util.Optional<T>
maybeAs(java.lang.Object datum, java.lang.Class<T> type)
-
-
-
Method Detail
-
as
@Nonnull public static <T> T as(@Nonnull java.lang.Object datum, @Nonnull java.lang.Class<T> roleType)
-
as
@Nonnull @Deprecated public static <T> T as(@Nonnull java.lang.Object datum, @Nonnull java.lang.Class<T> roleType, @Nonnull As.NotFoundBehaviour<T> notFoundBehaviour)
Deprecated.
-
maybeAs
@Nonnull public static <T> java.util.Optional<T> maybeAs(@Nonnull java.lang.Object datum, @Nonnull java.lang.Class<T> type)
-
asMany
@Nonnull public static <T> java.util.Collection<T> asMany(@Nonnull java.lang.Object datum, @Nonnull java.lang.Class<T> type)
-
as
@Nonnull public static <T> T as(@Nonnull java.lang.Object datum, @Nonnull As.Type<T> type)
-
maybeAs
@Nonnull public static <T> java.util.Optional<T> maybeAs(@Nonnull java.lang.Object datum, @Nonnull As.Type<T> type)
-
asMany
@Nonnull public static <T> java.util.Collection<T> asMany(@Nonnull java.lang.Object datum, @Nonnull As.Type<T> type)
-
-