Class AsExtensions

java.lang.Object
it.tidalwave.util.AsExtensions

public class AsExtensions extends Object
An extension to be used with Lombok in order to provide "as" support to classes that don't implement the As 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 Details

    • AsExtensions

      public AsExtensions()
  • Method Details

    • as

      @Nonnull public static <T> T as(@Nonnull Object datum, @Nonnull Class<T> roleType)
    • maybeAs

      @Nonnull public static <T> Optional<T> maybeAs(@Nonnull Object datum, @Nonnull Class<? extends T> type)
    • asMany

      @Nonnull public static <T> Collection<T> asMany(@Nonnull Object datum, @Nonnull Class<? extends T> type)
    • as

      @Nonnull public static <T> T as(@Nonnull Object datum, @Nonnull As.Type<? extends T> type)
    • maybeAs

      @Nonnull public static <T> Optional<T> maybeAs(@Nonnull Object datum, @Nonnull As.Type<? extends T> type)
    • asMany

      @Nonnull public static <T> Collection<T> asMany(@Nonnull Object datum, @Nonnull As.Type<? extends T> type)