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 boolean
isWrapperFor
(Class<?> iface) Tests if this object instance is of the base- or subclass of theiface
class.default <T> T
Returns the cast classiface
instance if possible, otherwise null.
Method Details
unwrap
Returns the cast classiface
instance 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 theiface
class. 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
iface
class is assignable from this instance class. - See Also: