FormService.java 文件源码

java
阅读 19 收藏 0 点赞 0 评论 0

项目:abstractform 作者:
/**
 * Find in the Service Loader a {@link FormToolkit} that returns the required form instance type of rendered forms
 * 
 * @param implementationClass
 *            The specific implementation class that the form toolkit must return
 * @return The FormToolkit that build form instances of that its specific implementation returns the given class
 * @throws ServiceNotFoundException
 *             When a FormToolkit is not found
 */
@SuppressWarnings("unchecked")
public <S> FormToolkit<S> getFormToolkit(Class<S> implementationClass) throws ServiceNotFoundException {
    Iterator<FormToolkit> it = loader.iterator();
    FormToolkit toolkit = null;
    while (toolkit == null && it.hasNext()) {
        FormToolkit tl = it.next();
        if (implementationClass.isAssignableFrom(tl.getImplementationClass())) {
            toolkit = tl;
        }
    }
    if (toolkit == null) {
        throw new ServiceNotFoundException();
    } else {
        return toolkit;
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号