Interface EntityDelegator

All Known Implementing Classes:
DefaultEntityDelegator

public interface EntityDelegator
An entity delegator allows for delegating entities to a custom class. A delegated entity is created such that the delegated type R is a subclass of the original entity type T.
Delegated entities allow for all sorts of useful things! Consider the following: final CustomUser user = (CustomUser) catnip.cache().user("snowflake"); By implementing an entity delegator, you can use your custom entity class ANYWHERE, as long as you implement this interface! The intent of an entity delegator is that all methods you aren't implementing yourself can be passed through to the original entity, or "delegated" entity.
Since:
2/13/20.
Author:
amy
  • Method Summary

    Modifier and Type
    Method
    Description
    <T, R extends T>
    R
    delegate(Class<T> type, T data)
    Delegates the provided entity.
  • Method Details

    • delegate

      <T, R extends T> R delegate(@Nonnull Class<T> type, @Nonnull T data)
      Delegates the provided entity.
      Type Parameters:
      T - The type of entity being delegated.
      R - The entity delegate. Must be a subclass of T.
      Parameters:
      type - The type of the entity being delegated.
      data - The entity to delegate.
      Returns:
      The delegated entity.