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


Java XmlInputStream类代码示例

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


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

示例1: setMetadata

import com.sforce.ws.parser.XmlInputStream; //导入依赖的package包/类
/**
 * Sets the metadata on the containerMember reflectively. We do it this way because the containerMembers are
 * generated from the WSDL and do not implement a common interface/hierarchy. If we don't use reflection, we end up
 * with a lot of boilerplate code. The downside of reflection is that it can be slower - though this is not in a
 * critical code path.
 * 
 * @param containerMember
 *            This object must have a setMetadata method on it since it will be called reflectively.
 * @param metadataComponent
 *            The component that contains the metadata as its body
 * @throws Exception
 */
static void setMetadata(Object containerMember, Component metadataComponent) throws Exception {
    Method[] methods = containerMember.getClass().getMethods();
    Method setMetadataMethod = null;

    for (Method method : methods) {
        if (method.getName().equals("setMetadata")) {
            setMetadataMethod = method;
            break;
        }
    }

    if (setMetadataMethod != null) {
        Class<?> metadataType = (setMetadataMethod.getParameterTypes())[0]; // There is only one parameter
        Object metadataInstance = metadataType.newInstance();
        XmlInputStream xis = createCorrespondingXmlInputStream(metadataComponent);
        Method loadMethod = metadataType.getMethod("load", XmlInputStream.class, TypeMapper.class);
        loadMethod.invoke(metadataInstance, xis, new TypeMapper());
        setMetadataMethod.invoke(containerMember, metadataInstance);
    }
}
 
开发者ID:forcedotcom,项目名称:idecore,代码行数:33,代码来源:ContainerMemberFactory.java

示例2: createCorrespondingXmlInputStream

import com.sforce.ws.parser.XmlInputStream; //导入依赖的package包/类
private static XmlInputStream createCorrespondingXmlInputStream(Component metadata) throws Exception, PullParserException {
    String body = replaceNamespace(metadata.getBody(), "urn:metadata.tooling.soap.sforce.com");
    XmlInputStream xis = new XmlInputStream();
    xis.setInput(new ByteArrayInputStream(body.getBytes()), "UTF-8");
    return xis;
}
 
开发者ID:forcedotcom,项目名称:idecore,代码行数:7,代码来源:ContainerMemberFactory.java


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