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


Java JAXBElement类代码示例

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


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

示例1: unmarshal

import javax.xml.bind.JAXBElement; //导入依赖的package包/类
public static <T> T unmarshal(final JAXBContext context, final Class<T> clazz, final String data,
        final XmlAdapter<?, ?>... adapters) {
    if (data != null) {
        final String trimmed = data.trim();
        if (trimmed.length() > 0) {
            try {
                final Unmarshaller unmarshaller = context.createUnmarshaller();

                if (adapters != null) {
                    for (final XmlAdapter<?, ?> adapter : adapters) {
                        unmarshaller.setAdapter(adapter);
                    }
                }

                final JAXBElement<T> jaxbElement = unmarshaller.unmarshal(
                        new StreamSource(new ByteArrayInputStream(trimmed.getBytes(StandardCharsets.UTF_8))),
                        clazz);
                return jaxbElement.getValue();
            } catch (final JAXBException e) {
                throw new RuntimeException("Invalid XML " + trimmed, e);
            }
        }
    }
    return null;
}
 
开发者ID:gchq,项目名称:stroom-stats,代码行数:26,代码来源:XMLMarshallerUtil.java

示例2: printLogAndReturn

import javax.xml.bind.JAXBElement; //导入依赖的package包/类
/**
 * Print the created XML to verify. Usage: return printLogAndReturn(new JAXBElement(rootElementName, StoreOperationInput.class, input));
 *
 * @return JAXBElement - same object which came as input.
 */
private static JAXBElement printLogAndReturn(JAXBElement jaxbElement) {
    try {
        // Create a String writer object which will be
        // used to write jaxbElment XML to string
        StringWriter writer = new StringWriter();

        // create JAXBContext which will be used to update writer
        JAXBContext context = JAXBContext.newInstance(StoreOperationInput.class);

        // marshall or convert jaxbElement containing student to xml format
        context.createMarshaller().marshal(jaxbElement, writer);

        // print XML string representation of Student object
        System.out.println(writer.toString());
    }
    catch (JAXBException e) {
        e.printStackTrace();
    }
    return jaxbElement;
}
 
开发者ID:Microsoft,项目名称:elastic-db-tools-for-java,代码行数:26,代码来源:StoreOperationRequestBuilder.java

示例3: puraText

import javax.xml.bind.JAXBElement; //导入依赖的package包/类
protected void puraText(POCDMT000040Section section, List<String> nayttomuoto) {
    StrucDocText text = section.getText();
    if ( text != null && text.getContent() != null && !text.getContent().isEmpty() ) {
        List<Serializable> content = text.getContent();
        for (int i = 0; i < content.size(); i++) {
            if ( !(content.get(i) instanceof JAXBElement) ) {
                continue;
            }
            JAXBElement<?> elem = (JAXBElement<?>) content.get(i);
            if ( elem.getValue() instanceof StrucDocParagraph ) {
                StrucDocParagraph paragraph = (StrucDocParagraph) elem.getValue();
                puraDocParagraph(paragraph, nayttomuoto);
            }
        }
    }
}
 
开发者ID:TheFinnishSocialInsuranceInstitution,项目名称:KantaCDA-API,代码行数:17,代码来源:Purkaja.java

示例4: generateRedirectURL

import javax.xml.bind.JAXBElement; //导入依赖的package包/类
private String generateRedirectURL(JAXBElement<AuthnRequestType> authRequest, String url){

        if (authSettings.getIssuer() == null) {
            return null;
        }

        URL redirectURL;

        RedirectSamlURLBuilder<AuthnRequestType> redirectSamlURLBuilder = new RedirectSamlURLBuilder<>();
        try {
            redirectURL = redirectSamlURLBuilder
                    .addRelayState(getRelayState())
                    .addSamlRequest(authRequest)
                    .addRedirectEndpoint(
                            new URL(url))
                    .getURL();
        } catch (Exception e) {
            getLogger().logError(Log4jLogger.SYSTEM_LOG, e,
                    LogMessageIdentifier.ERROR_AUTH_REQUEST_GENERATION_FAILED);
            return null;
        }

        return redirectURL.toString();
    }
 
开发者ID:servicecatalog,项目名称:oscm,代码行数:25,代码来源:AuthenticationHandler.java

示例5: createGetLicenseTextHtmlResponse

import javax.xml.bind.JAXBElement; //导入依赖的package包/类
@XmlElementDecl(
        namespace = "http://ws.update.deployment.rapid_i.com/",
        name = "getLicenseTextHtmlResponse"
)
public JAXBElement<GetLicenseTextHtmlResponse> createGetLicenseTextHtmlResponse(GetLicenseTextHtmlResponse value) {
    return new JAXBElement(_GetLicenseTextHtmlResponse_QNAME, GetLicenseTextHtmlResponse.class, (Class)null, value);
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:8,代码来源:ObjectFactory.java

示例6: createLogoutResponse

import javax.xml.bind.JAXBElement; //导入依赖的package包/类
/**
 * Create an instance of {@link JAXBElement }{@code <}
 * {@link StatusResponseType }{@code >}
 * 
 */
@XmlElementDecl(namespace = "urn:oasis:names:tc:SAML:2.0:protocol", name = "LogoutResponse")
public JAXBElement<StatusResponseType> createLogoutResponse(
        StatusResponseType value) {
    return new JAXBElement<StatusResponseType>(_LogoutResponse_QNAME,
            StatusResponseType.class, null, value);
}
 
开发者ID:servicecatalog,项目名称:oscm,代码行数:12,代码来源:ObjectFactory.java

示例7: createGetMirrors

import javax.xml.bind.JAXBElement; //导入依赖的package包/类
@XmlElementDecl(
        namespace = "http://ws.update.deployment.rapid_i.com/",
        name = "getMirrors"
)
public JAXBElement<GetMirrors> createGetMirrors(GetMirrors value) {
    return new JAXBElement(_GetMirrors_QNAME, GetMirrors.class, (Class)null, value);
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:8,代码来源:ObjectFactory.java

示例8: exportToXmlNode

import javax.xml.bind.JAXBElement; //导入依赖的package包/类
/**
 * Exports a given {@link ConstraintSpecification} as a XML {@link Node}.
 *
 * @param source The specification that should be exported
 * @return The XML Node representing the specification
 * @throws ExportException Exception during marshalling
 */
@Override
public Node exportToXmlNode(ConstraintSpecification source) throws ExportException {
  SpecificationTable specTable =
      objectFactory.createSpecificationTable();
  specTable.setVariables(makeVariables(source));
  specTable.setRows(makeRows(source));
  specTable.setComment(source.getComment());
  specTable.setIsConcrete(false);
  specTable.setName(source.getName());
  JAXBElement<SpecificationTable> element =
      objectFactory.createSpecification(specTable);
  return marshalToNode(element, OF_STVS);
}
 
开发者ID:VerifAPS,项目名称:stvs,代码行数:21,代码来源:XmlConstraintSpecExporter.java

示例9: createKeyValue

import javax.xml.bind.JAXBElement; //导入依赖的package包/类
/**
 * Create an instance of {@link JAXBElement }{@code <}{@link KeyValueType }
 * {@code >}
 * 
 */
@XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "KeyValue")
public JAXBElement<KeyValueType> createKeyValue(KeyValueType value) {
    return new JAXBElement<KeyValueType>(_KeyValue_QNAME,
            KeyValueType.class, null, value);
}
 
开发者ID:servicecatalog,项目名称:oscm,代码行数:11,代码来源:ObjectFactory.java

示例10: createProgramasResponse

import javax.xml.bind.JAXBElement; //导入依赖的package包/类
/**
 * Create an instance of {@link JAXBElement }{@code <}{@link ProgramasResponse }{@code >}}
 * 
 */
@XmlElementDecl(namespace = "http://queries.service.siaf.hacienda.gov.py/", name = "programasResponse")
public JAXBElement<ProgramasResponse> createProgramasResponse(ProgramasResponse value) {
    return new JAXBElement<ProgramasResponse>(_ProgramasResponse_QNAME, ProgramasResponse.class, null, value);
}
 
开发者ID:stppy,项目名称:spr,代码行数:9,代码来源:ObjectFactory.java

示例11: createStatusCode

import javax.xml.bind.JAXBElement; //导入依赖的package包/类
/**
 * Create an instance of {@link JAXBElement }{@code <}{@link StatusCodeType }{@code >}}
 * 
 */
@XmlElementDecl(namespace = "urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2", name = "StatusCode")
public JAXBElement<StatusCodeType> createStatusCode(StatusCodeType value) {
    return new JAXBElement<StatusCodeType>(_StatusCode_QNAME, StatusCodeType.class, null, value);
}
 
开发者ID:AlnaSoftware,项目名称:eSaskaita,代码行数:9,代码来源:ObjectFactory.java

示例12: createMiddleName

import javax.xml.bind.JAXBElement; //导入依赖的package包/类
/**
 * Create an instance of {@link JAXBElement }{@code <}{@link MiddleNameType }{@code >}}
 * 
 */
@XmlElementDecl(namespace = "urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2", name = "MiddleName")
public JAXBElement<MiddleNameType> createMiddleName(MiddleNameType value) {
    return new JAXBElement<MiddleNameType>(_MiddleName_QNAME, MiddleNameType.class, null, value);
}
 
开发者ID:AlnaSoftware,项目名称:eSaskaita,代码行数:9,代码来源:ObjectFactory.java

示例13: createCommitmentTypeIndication

import javax.xml.bind.JAXBElement; //导入依赖的package包/类
/**
 * Create an instance of {@link JAXBElement }{@code <}{@link CommitmentTypeIndicationType }{@code >}}
 * 
 */
@XmlElementDecl(namespace = "http://uri.etsi.org/01903/v1.3.2#", name = "CommitmentTypeIndication")
public JAXBElement<CommitmentTypeIndicationType> createCommitmentTypeIndication(CommitmentTypeIndicationType value) {
    return new JAXBElement<CommitmentTypeIndicationType>(_CommitmentTypeIndication_QNAME, CommitmentTypeIndicationType.class, null, value);
}
 
开发者ID:AlnaSoftware,项目名称:eSaskaita,代码行数:9,代码来源:ObjectFactory.java

示例14: createDespatchAddress

import javax.xml.bind.JAXBElement; //导入依赖的package包/类
/**
 * Create an instance of {@link JAXBElement }{@code <}{@link AddressType }{@code >}}
 * 
 */
@XmlElementDecl(namespace = "urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2", name = "DespatchAddress")
public JAXBElement<AddressType> createDespatchAddress(AddressType value) {
    return new JAXBElement<AddressType>(_DespatchAddress_QNAME, AddressType.class, null, value);
}
 
开发者ID:AlnaSoftware,项目名称:eSaskaita,代码行数:9,代码来源:ObjectFactory.java

示例15: createDealCard

import javax.xml.bind.JAXBElement; //导入依赖的package包/类
/**
 * Create an instance of {@link JAXBElement }{@code <}{@link DealCard }{@code >}}
 * 
 */
@XmlElementDecl(namespace = "http://blackjack.deitel.com/", name = "dealCard")
public JAXBElement<DealCard> createDealCard(DealCard value) {
    return new JAXBElement<DealCard>(_DealCard_QNAME, DealCard.class, null, value);
}
 
开发者ID:cleitonferreira,项目名称:LivroJavaComoProgramar10Edicao,代码行数:9,代码来源:ObjectFactory.java


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