Package com.mewna.catnip.entity.delegate
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
Delegated entities allow for all sorts of useful things! Consider the following:
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
-
Method Details
-
delegate
Delegates the provided entity.- Type Parameters:
T
- The type of entity being delegated.R
- The entity delegate. Must be a subclass ofT
.- Parameters:
type
- The type of the entity being delegated.data
- The entity to delegate.- Returns:
- The delegated entity.
-