Created
March 26, 2016 00:07
-
-
Save Tires/37923adef7a36e2f6a1a to your computer and use it in GitHub Desktop.
Extract a wrapped JSF facade
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@SuppressWarnings("unchecked") | |
public static <S, T extends S> T unwrap(S source, Class<T> targetType) { | |
while (source != null) { | |
if (targetType.isInstance(source)) | |
return (T)source; | |
if (!(source instanceof FacesWrapper)) | |
break; | |
source = ((FacesWrapper<S>)source).getWrapped(); | |
} | |
return null; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment