本文整理汇总了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;
}
示例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;
}
示例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);
}
}
}
}
示例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();
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}