当前位置: 首页>>代码示例>>Java>>正文


Java ModelGenerator类代码示例

本文整理汇总了Java中com.sun.xml.internal.ws.api.policy.ModelGenerator的典型用法代码示例。如果您正苦于以下问题:Java ModelGenerator类的具体用法?Java ModelGenerator怎么用?Java ModelGenerator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ModelGenerator类属于com.sun.xml.internal.ws.api.policy包,在下文中一共展示了ModelGenerator类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: writePolicyOrReferenceIt

import com.sun.xml.internal.ws.api.policy.ModelGenerator; //导入依赖的package包/类
/**
 * Adds a PolicyReference element that points to the policy of the element,
 * if the policy does not have any id or name. Writes policy inside the element otherwise.
 *
 * @param subject
 *      PolicySubject to be referenced or marshalled
 * @param writer
 *      A TXW on to which we shall add the PolicyReference
 */
private void writePolicyOrReferenceIt(final PolicySubject subject, final TypedXmlWriter writer) {
    final Policy policy;
    try {
        policy = subject.getEffectivePolicy(merger);
    } catch (PolicyException e) {
        throw LOGGER.logSevereException(new WebServiceException(PolicyMessages.WSP_1011_FAILED_TO_RETRIEVE_EFFECTIVE_POLICY_FOR_SUBJECT(subject.toString()), e));
    }
    if (policy != null) {
        if (null == policy.getIdOrName()) {
            final PolicyModelGenerator generator = ModelGenerator.getGenerator();
            try {
                final PolicySourceModel policyInfoset = generator.translate(policy);
                marshaller.marshal(policyInfoset, writer);
            } catch (PolicyException pe) {
                throw LOGGER.logSevereException(new WebServiceException(PolicyMessages.WSP_1002_UNABLE_TO_MARSHALL_POLICY_OR_POLICY_REFERENCE(), pe));
            }
        } else {
            final TypedXmlWriter policyReference = writer._element(policy.getNamespaceVersion().asQName(XmlToken.PolicyReference), TypedXmlWriter.class);
            policyReference._attribute(XmlToken.Uri.toString(), '#' + policy.getIdOrName());
        }
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:32,代码来源:PolicyWSDLGeneratorExtension.java


注:本文中的com.sun.xml.internal.ws.api.policy.ModelGenerator类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。