GenericPortletBean.java 文件源码

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

项目:spring4-understanding 作者:
/**
 * Create new PortletConfigPropertyValues.
 * @param config PortletConfig we'll use to take PropertyValues from
 * @param requiredProperties set of property names we need, where
 * we can't accept default values
 * @throws PortletException if any required properties are missing
 */
private PortletConfigPropertyValues(PortletConfig config, Set<String> requiredProperties)
    throws PortletException {

    Set<String> missingProps = (requiredProperties != null && !requiredProperties.isEmpty()) ?
            new HashSet<String>(requiredProperties) : null;

    Enumeration<String> en = config.getInitParameterNames();
    while (en.hasMoreElements()) {
        String property = en.nextElement();
        Object value = config.getInitParameter(property);
        addPropertyValue(new PropertyValue(property, value));
        if (missingProps != null) {
            missingProps.remove(property);
        }
    }

    // fail if we are still missing properties
    if (missingProps != null && missingProps.size() > 0) {
        throw new PortletException(
            "Initialization from PortletConfig for portlet '" + config.getPortletName() +
            "' failed; the following required properties were missing: " +
            StringUtils.collectionToDelimitedString(missingProps, ", "));
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号