Package com.iizix
Interface IWrapper
public interface IWrapper
Helper interface used to verify if an instance of an interface is assignable to a class and also to cast it to the requested class without throwing an error.
- Author:
- Freggle, Christopher Mindus
- Method SummaryModifier and TypeMethodDescription- default boolean- isWrapperFor- (Class<?> iface) Tests if this object instance is of the base- or subclass of the- ifaceclass.- default <T> TReturns the cast class- ifaceinstance if possible, otherwise null.
- Method Details- unwrapReturns the cast class- ifaceinstance if possible, otherwise null.- Type Parameters:
- T- The class requested.
- Parameters:
- iface- The class to cast to.
- Returns:
- The class cast as requested by iface, otherwise null.
 
- isWrapperForTests if this object instance is of the base- or subclass of the- ifaceclass. This method is typically used to identify an instance known as an instance of an interface, and the caller wishes to verify if it's really an implementation of a class that in turn implements or specifies the interface- iface.- Parameters:
- iface- The class to check.
- Returns:
- true if the ifaceclass is assignable from this instance class.
- See Also: