示例#1
0
 /**
  * get tag that has specified id attribute. You don't need to cast() because you can specify the
  * tag type.
  *
  * <pre>
  * // sample: get a Div tag having id=&quot;foo&quot; attribute.
  * html.getById(&quot;foo&quot;, Div.class);
  * </pre>
  *
  * @param id
  * @param tagType
  * @return
  * @throws TagTypeUnmatchException
  */
 @SuppressWarnings("unchecked")
 public <T extends AbstractJaxb> T getById(String id, Class<T> tagType)
     throws TagTypeUnmatchException {
   Object obj = GetByIdUtil.getById(id, this);
   if (obj != null && !obj.getClass().isAssignableFrom(tagType)) {
     throw new TagTypeUnmatchException(tagType.getClass(), obj.getClass());
   }
   return (T) obj;
 }
示例#2
0
 /**
  * get tag that has specified id attribute. To use return value as ussual tag, you must cast() it.
  *
  * @param id
  * @return
  */
 @SuppressWarnings("unchecked")
 public <T extends AbstractJaxb> T getById(String id) {
   Object obj = GetByIdUtil.getById(id, this);
   return (T) obj;
 }