类javax.xml.bind.JAXBElement源码实例Demo

下面列出了怎么用javax.xml.bind.JAXBElement的API类实例代码及写法,或者点击链接到github查看源代码。

private LoginIdentityProviders loadLoginIdentityProvidersConfiguration() throws Exception {
    final File loginIdentityProvidersConfigurationFile = properties.getLoginIdentityProviderConfigurationFile();

    // load the users from the specified file
    if (loginIdentityProvidersConfigurationFile.exists()) {
        try {
            // find the schema
            final SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
            final Schema schema = schemaFactory.newSchema(LoginIdentityProviders.class.getResource(LOGIN_IDENTITY_PROVIDERS_XSD));

            // attempt to unmarshal
            final Unmarshaller unmarshaller = JAXB_CONTEXT.createUnmarshaller();
            unmarshaller.setSchema(schema);
            final JAXBElement<LoginIdentityProviders> element = unmarshaller.unmarshal(new StreamSource(loginIdentityProvidersConfigurationFile), LoginIdentityProviders.class);
            return element.getValue();
        } catch (SAXException | JAXBException e) {
            throw new Exception("Unable to load the login identity provider configuration file at: " + loginIdentityProvidersConfigurationFile.getAbsolutePath());
        }
    } else {
        throw new Exception("Unable to find the login identity provider configuration file at " + loginIdentityProvidersConfigurationFile.getAbsolutePath());
    }
}
 
源代码2 项目: freehealth-connector   文件: MarshallerHelper.java
public String toString(Y data) {
   StringWriter writer = new StringWriter();

   try {
      if (!data.getClass().isAnnotationPresent(XmlRootElement.class) && !(data instanceof JAXBElement)) {
         JAXBElement<Y> jaxbElement = new JAXBElement(translate(data.getClass()), this.marshallClass, data);
         this.getMarshaller().marshal(jaxbElement, writer);
      } else {
         this.getMarshaller().marshal(data, writer);
      }
   } catch (JAXBException var4) {
      throw handleException(var4);
   }

   return writer.toString();
}
 
源代码3 项目: citygml4j   文件: Generics200Marshaller.java
private TypeMapper<JAXBElement<?>> getElementMapper() {
	if (elementMapper == null) {
		lock.lock();
		try {
			if (elementMapper == null) {
				elementMapper = TypeMapper.<JAXBElement<?>>create()
						.with(GenericCityObject.class, this::createGenericCityObject)
						.with(DateAttribute.class, this::createDateAttribute)
						.with(DoubleAttribute.class, this::createDoubleAttribute)
						.with(IntAttribute.class, this::createIntAttribute)
						.with(StringAttribute.class, this::createStringAttribute)
						.with(UriAttribute.class, this::createUriAttribute)
						.with(MeasureAttribute.class, this::createMeasureAttribute)
						.with(GenericAttributeSet.class, this::createGenericAttributeSet);
			}
		} finally {
			lock.unlock();
		}
	}

	return elementMapper;
}
 
源代码4 项目: fosstrak-epcis   文件: CaptureClient.java
/**
 * Sends the given EPCIS Document to the EPCIS capture interface. Please see
 * the <a href="http://www.fosstrak.org/epcis/docs/user-guide.html">Fosstrak
 * User-Guide</a> for more information and code samples.
 * 
 * @param epcisDoc
 *            The EPCIS Document with a list of events.
 * @return The HTTP response code from the repository.
 * @throws IOException
 *             If an error sending the document occurred.
 * @throws JAXBException
 *             If an error serializing the given document into XML occurred.
 */
public int capture(final Document epcisDoc) throws CaptureClientException {
    StringWriter writer = new StringWriter();
    ObjectFactory objectFactory = new ObjectFactory();
    try {
        JAXBContext context = JAXBContext.newInstance("org.fosstrak.epcis.model");
        JAXBElement<? extends Document> item;
        if (epcisDoc instanceof EPCISDocumentType) {
            item = objectFactory.createEPCISDocument((EPCISDocumentType) epcisDoc);
        } else {
            item = objectFactory.createEPCISMasterDataDocument((EPCISMasterDataDocumentType) epcisDoc);
        }
        Marshaller marshaller = context.createMarshaller();
        marshaller.setProperty(Marshaller.JAXB_ENCODING, "UTF-8");
        marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
        marshaller.marshal(item, writer);
    } catch (JAXBException e) {
        throw new CaptureClientException("error serializing EPCIS Document: " + e.getMessage(), e);
    }
    return capture(writer.toString());
}
 
源代码5 项目: citygml4j   文件: Building200Unmarshaller.java
public void unmarshalDoor(DoorType src, Door dest) throws MissingADESchemaException {
	unmarshalAbstractOpening(src, dest);

	if (src.isSetAddress()) {
		for (AddressPropertyType addressProperty : src.getAddress())
			dest.addAddress(citygml.getCore200Unmarshaller().unmarshalAddressProperty(addressProperty));
	}

	if (src.isSet_GenericApplicationPropertyOfDoor()) {
		for (JAXBElement<Object> elem : src.get_GenericApplicationPropertyOfDoor()) {
			ADEModelObject ade = jaxb.getADEUnmarshaller().unmarshal(elem);
			if (ade != null)
				dest.addGenericApplicationPropertyOfDoor(ade);
		}
	}
}
 
源代码6 项目: citygml4j   文件: Appearance200Unmarshaller.java
public void unmarshalAppearance(AppearanceType src, Appearance dest) throws MissingADESchemaException {
	jaxb.getGMLUnmarshaller().unmarshalAbstractFeature(src, dest);

	if (src.isSetTheme())
		dest.setTheme(src.getTheme());

	if (src.isSetSurfaceDataMember()) {
		for (SurfaceDataPropertyType surfaceDataMember : src.getSurfaceDataMember())
			dest.addSurfaceDataMember(unmarshalSurfaceDataProperty(surfaceDataMember));
	}

	if (src.isSet_GenericApplicationPropertyOfAppearance()) {
		for (JAXBElement<Object> elem : src.get_GenericApplicationPropertyOfAppearance()) {
			ADEModelObject ade = jaxb.getADEUnmarshaller().unmarshal(elem);
			if (ade != null)
				dest.addGenericApplicationPropertyOfAppearance(ade);
		}
	}
}
 
源代码7 项目: freehealth-connector   文件: ObjectFactory.java
@XmlElementDecl(
   namespace = "http://uri.etsi.org/01903/v1.3.2#",
   name = "CompleteCertificateRefs"
)
public JAXBElement<CompleteCertificateRefsType> createCompleteCertificateRefs(CompleteCertificateRefsType value) {
   return new JAXBElement(_CompleteCertificateRefs_QNAME, CompleteCertificateRefsType.class, (Class)null, value);
}
 
源代码8 项目: openjdk-jdk8u   文件: UnmarshallerImpl.java
@Override
public <T> JAXBElement<T> unmarshal(XMLStreamReader reader, Class<T> expectedType) throws JAXBException {
    if (expectedType==null) {
        throw new IllegalArgumentException();
    }
    return (JAXBElement)unmarshal0(reader,getBeanInfo(expectedType));
}
 
源代码9 项目: freehealth-connector   文件: ObjectFactory.java
@XmlElementDecl(
   namespace = "http://www.w3.org/2001/04/xmlenc#",
   name = "RecipientKeyInfo",
   scope = AgreementMethod.class
)
public JAXBElement<KeyInfo> createAgreementMethodRecipientKeyInfo(KeyInfo value) {
   return new JAXBElement(_AgreementMethodRecipientKeyInfo_QNAME, KeyInfo.class, AgreementMethod.class, value);
}
 
源代码10 项目: citygml4j   文件: Transportation200Unmarshaller.java
public void unmarshalTrack(TrackType src, Track dest) throws MissingADESchemaException {
	unmarshalTransportationComplex(src, dest);

	if (src.isSet_GenericApplicationPropertyOfTrack()) {
		for (JAXBElement<Object> elem : src.get_GenericApplicationPropertyOfTrack()) {
			ADEModelObject ade = jaxb.getADEUnmarshaller().unmarshal(elem);
			if (ade != null)
				dest.addGenericApplicationPropertyOfTrack(ade);
		}
	}
}
 
源代码11 项目: freehealth-connector   文件: ObjectFactory.java
@XmlElementDecl(
   namespace = "http://uri.etsi.org/01903/v1.3.2#",
   name = "AttributeCertificateRefs"
)
public JAXBElement<CompleteCertificateRefsType> createAttributeCertificateRefs(CompleteCertificateRefsType value) {
   return new JAXBElement(_AttributeCertificateRefs_QNAME, CompleteCertificateRefsType.class, (Class)null, value);
}
 
源代码12 项目: cxf   文件: XKMSInvoker.java
protected ValidateRequestType prepareValidateXKMSRequest(
                                                      X509Certificate cert) {
    JAXBElement<byte[]> x509Cert;
    try {
        x509Cert = DSIG_OF.createX509DataTypeX509Certificate(cert
            .getEncoded());
    } catch (CertificateEncodingException e) {
        throw new IllegalArgumentException(e);
    }
    X509DataType x509DataType = DSIG_OF.createX509DataType();
    x509DataType.getX509IssuerSerialOrX509SKIOrX509SubjectName().add(
                                                                     x509Cert);
    JAXBElement<X509DataType> x509Data = DSIG_OF
        .createX509Data(x509DataType);

    KeyInfoType keyInfoType = DSIG_OF.createKeyInfoType();
    keyInfoType.getContent().add(x509Data);

    QueryKeyBindingType queryKeyBindingType = XKMS_OF
        .createQueryKeyBindingType();
    queryKeyBindingType.setKeyInfo(keyInfoType);

    ValidateRequestType validateRequestType = XKMS_OF
        .createValidateRequestType();
    setGenericRequestParams(validateRequestType);
    validateRequestType.setQueryKeyBinding(queryKeyBindingType);
    // temporary
    validateRequestType.setId(cert.getSubjectDN().toString());
    return validateRequestType;
}
 
源代码13 项目: freehealth-connector   文件: ObjectFactory.java
@XmlElementDecl(
   namespace = "http://www.ehealth.fgov.be/standards/kmehr/schema/v1",
   name = "quantity",
   scope = CompoundprescriptionType.class
)
public JAXBElement<QuantityType> createCompoundprescriptionTypeQuantity(QuantityType value) {
   return new JAXBElement(_RegimenQuantity_QNAME, QuantityType.class, CompoundprescriptionType.class, value);
}
 
源代码14 项目: freehealth-connector   文件: ObjectFactory.java
@XmlElementDecl(
   namespace = "urn:oasis:names:tc:SAML:1.0:protocol",
   name = "SubjectQuery"
)
public JAXBElement<SubjectQueryAbstractType> createSubjectQuery(SubjectQueryAbstractType value) {
   return new JAXBElement(_SubjectQuery_QNAME, SubjectQueryAbstractType.class, (Class)null, value);
}
 
源代码15 项目: spring-ws   文件: TicketAgentEndpoint.java
@PayloadRoot(namespace = "http://example.org/TicketAgent.xsd", localPart = "listFlightsRequest")
@ResponsePayload
public JAXBElement<TFlightsResponse> listFlights(
    @RequestPayload JAXBElement<TListFlights> request) {
  ObjectFactory factory = new ObjectFactory();
  TFlightsResponse tFlightsResponse = factory.createTFlightsResponse();
  tFlightsResponse.getFlightNumber().add(BigInteger.valueOf(101));

  return factory.createListFlightsResponse(tFlightsResponse);
}
 
源代码16 项目: tomee   文件: ObjectFactory.java
/**
 * Create an instance of {@link JAXBElement }{@code <}
 * {@link MessageDestinationRef }{@code >}
 */
@XmlElementDecl(namespace = "common.xmi", name = "MessageDestinationRef")
public JAXBElement<MessageDestinationRef> createMessageDestinationRef(
    final MessageDestinationRef value) {
    return new JAXBElement<MessageDestinationRef>(
        _MessageDestinationRef_QNAME, MessageDestinationRef.class,
        null, value);
}
 
源代码17 项目: citygml4j   文件: Tunnel200Marshaller.java
public void marshalIntTunnelInstallation(IntTunnelInstallation src, IntTunnelInstallationType dest) {
	citygml.getCore200Marshaller().marshalAbstractCityObject(src, dest);

	if (src.isSetClazz())
		dest.setClazz(jaxb.getGMLMarshaller().marshalCode(src.getClazz()));

	if (src.isSetFunction()) {
		for (Code function : src.getFunction())
			dest.getFunction().add(jaxb.getGMLMarshaller().marshalCode(function));
	}

	if (src.isSetUsage()) {
		for (Code usage : src.getUsage())
			dest.getUsage().add(jaxb.getGMLMarshaller().marshalCode(usage));
	}

	if (src.isSetLod4Geometry())
		dest.setLod4Geometry(jaxb.getGMLMarshaller().marshalGeometryProperty(src.getLod4Geometry()));

	if (src.isSetLod4ImplicitRepresentation())
		dest.setLod4ImplicitRepresentation(citygml.getCore200Marshaller().marshalImplicitRepresentationProperty(src.getLod4ImplicitRepresentation()));

	if (src.isSetBoundedBySurface()) {
		for (BoundarySurfaceProperty boundarySurfaceProperty : src.getBoundedBySurface())
			dest.getBoundedBySurface().add(marshalBoundarySurfaceProperty(boundarySurfaceProperty));
	}

	if (src.isSetGenericApplicationPropertyOfIntTunnelInstallation()) {
		for (ADEComponent adeComponent : src.getGenericApplicationPropertyOfIntTunnelInstallation()) {
			JAXBElement<Object> jaxbElement = jaxb.getADEMarshaller().marshalJAXBElement(adeComponent);
			if (jaxbElement != null)
				dest.get_GenericApplicationPropertyOfIntTunnelInstallation().add(jaxbElement);
		}
	}
}
 
源代码18 项目: freehealth-connector   文件: ObjectFactory.java
@XmlElementDecl(
   namespace = "http://www.apb.be/standards/smoa/schema/model/v1",
   name = "kmehrPrescription",
   substitutionHeadNamespace = "http://www.apb.be/standards/smoa/schema/model/v1",
   substitutionHeadName = "abstract-Prescription"
)
public JAXBElement<KmehrPrescriptionType> createKmehrPrescription(KmehrPrescriptionType value) {
   return new JAXBElement(_KmehrPrescription_QNAME, KmehrPrescriptionType.class, (Class)null, value);
}
 
源代码19 项目: steady   文件: SecurityTokenServiceProvider.java
private Object convertToJAXBObject(Source source) throws Exception {
    //this is entirely to work around http://java.net/jira/browse/JAXB-909
    //if that bug is ever fixed and we can detect it, we can remove this 
    //complete and total HACK HACK HACK and replace with just:  
    //Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
    //JAXBElement<?> jaxbElement = (JAXBElement<?>) unmarshaller.unmarshal(source);
    //return jaxbElement.getValue();
    
    Document d = StaxUtils.read(source);
    Binder<Node> binder = jaxbContext.createBinder();
    JAXBElement<?> jaxbElement = (JAXBElement<?>)binder.unmarshal(d);
    walkDom("", d.getDocumentElement(), binder, null);
    return jaxbElement.getValue();
}
 
源代码20 项目: OpenESPI-Common-java   文件: ObjectFactory.java
/**
 * Create an instance of {@link JAXBElement }{@code <}{@link LogoType }
 * {@code >}
 */
@XmlElementDecl(namespace = "http://www.w3.org/2005/Atom", name = "logo", scope = SourceType.class)
public JAXBElement<LogoType> createSourceTypeLogo(LogoType value) {
	return new JAXBElement<LogoType>(SourceTypeLogo_QNAME, LogoType.class,
			SourceType.class, value);
}
 
源代码21 项目: citygml4j   文件: GMLMarshaller.java
private JAXBElement<?> createMultiPoint(MultiPoint src) {
	return gml.createMultiPoint(marshalMultiPoint(src));
}
 
源代码22 项目: bluima   文件: ObjectFactory.java
/**
 * Create an instance of {@link JAXBElement }{@code <}{@link DeclareType }{@code >}}
 * 
 */
@XmlElementDecl(namespace = "http://www.w3.org/1998/Math/MathML", name = "declare")
public JAXBElement<DeclareType> createDeclare(DeclareType value) {
    return new JAXBElement<DeclareType>(_Declare_QNAME, DeclareType.class, null, value);
}
 
源代码23 项目: icure-backend   文件: ObjectFactory.java
/**
 * Create an instance of {@link JAXBElement }{@code <}{@link Signature }{@code >}}
 * 
 */
@XmlElementDecl(namespace = "http://www.ehealth.fgov.be/standards/kmehr/schema/v1", name = "Signature", scope = Kmehrmessage.class)
public JAXBElement<Signature> createKmehrmessageSignature(Signature value) {
    return new JAXBElement<Signature>(_KmehrmessageSignature_QNAME, Signature.class, Kmehrmessage.class, value);
}
 
源代码24 项目: cxf   文件: EncoderDecoder11Impl.java
public SequenceType decodeSequenceType(Element elem) throws JAXBException {
    Unmarshaller unmarshaller = getContext().createUnmarshaller();
    JAXBElement<SequenceType> jaxbElement = unmarshaller.unmarshal(elem, SequenceType.class);
    return jaxbElement.getValue();
}
 
源代码25 项目: proarc   文件: ObjectFactory.java
/**
 * Create an instance of {@link JAXBElement }{@code <}{@link TIdentifikator }{@code >}}
 * 
 */
@XmlElementDecl(namespace = "http://www.mvcr.cz/nsesss/v2", name = "IdentifikatorOrganizace", scope = TSubjektExterni.class)
public JAXBElement<TIdentifikator> createTSubjektExterniIdentifikatorOrganizace(TIdentifikator value) {
    return new JAXBElement<TIdentifikator>(_TSubjektExterniIdentifikatorOrganizace_QNAME, TIdentifikator.class, TSubjektExterni.class, value);
}
 
public <T> JAXBElement<T> unmarshal(Source source, Class<T> expectedType) throws JAXBException {
    throw new UnsupportedOperationException();
}
 
源代码27 项目: photon   文件: ObjectFactory.java
/**
 * Create an instance of {@link JAXBElement }{@code <}{@link X509DataType }{@code >}}
 * 
 */
@XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "X509Data")
public JAXBElement<X509DataType> createX509Data(X509DataType value) {
    return new JAXBElement<X509DataType>(_X509Data_QNAME, X509DataType.class, null, value);
}
 
源代码28 项目: icure-backend   文件: ObjectFactory.java
/**
 * Create an instance of {@link JAXBElement }{@code <}{@link byte[]}{@code >}}
 * 
 */
@XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "X509Certificate", scope = X509Data.class)
public JAXBElement<byte[]> createX509DataX509Certificate(byte[] value) {
    return new JAXBElement<byte[]>(_X509DataX509Certificate_QNAME, byte[].class, X509Data.class, ((byte[]) value));
}
 
源代码29 项目: sierra-ecg-tools   文件: ObjectFactory.java
/**
 * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}}
 * 
 */
@XmlElementDecl(namespace = "http://www3.medical.philips.com", name = "ppamp")
public JAXBElement<String> createPpamp(String value) {
    return new JAXBElement<String>(_Ppamp_QNAME, String.class, null, value);
}
 
源代码30 项目: sierra-ecg-tools   文件: ObjectFactory.java
/**
 * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}}
 * 
 */
@XmlElementDecl(namespace = "http://www3.medical.philips.com", name = "highpassfiltersetting")
public JAXBElement<String> createHighpassfiltersetting(String value) {
    return new JAXBElement<String>(_Highpassfiltersetting_QNAME, String.class, null, value);
}