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 Summary
Modifier and TypeMethodDescriptiondefault booleanisWrapperFor(Class<?> iface) Tests if this object instance is of the base- or subclass of theifaceclass.default <T> TReturns the cast classifaceinstance if possible, otherwise null.
Method Details
unwrap
Returns the cast classifaceinstance 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.
isWrapperFor
Tests if this object instance is of the base- or subclass of theifaceclass. 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 interfaceiface.- Parameters:
iface- The class to check.- Returns:
- true if the
ifaceclass is assignable from this instance class. - See Also: