Package org.shredzone.commons.taglib
Class TaglibUtils
- java.lang.Object
-
- org.shredzone.commons.taglib.TaglibUtils
-
@ParametersAreNonnullByDefault public final class TaglibUtils extends Object
Utility class for taglib beans.- Author:
- Richard "Shred" Körber
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T> T
findAncestorWithType(javax.servlet.jsp.tagext.Tag from, Class<T> type)
Finds an ancestor tag of the given type.
-
-
-
Method Detail
-
findAncestorWithType
public static <T> T findAncestorWithType(javax.servlet.jsp.tagext.Tag from, Class<T> type)
Finds an ancestor tag of the given type. Starting from the given Tag, it traverses up the parent tags until a tag of the given type is found.Use this method instead of
TagSupport.findAncestorWithClass(Tag, Class)
, as it is aware of proxied tag classes, while findAncestorWithClass only sees the proxy instances instead of the tag classes behind it. Furthermore, this method is also able to locate interfaces.- Type Parameters:
T
- Type to find and return- Parameters:
from
- Tag to start fromtype
- Type to find- Returns:
- Ancestor of that type, or
null
if none was found.
-
-