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


Java JAXBElement.getValue方法代码示例

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


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

示例1: 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

示例2: loadAuthorizersConfiguration

import javax.xml.bind.JAXBElement; //导入方法依赖的package包/类
private Authorizers loadAuthorizersConfiguration() throws Exception {
    final File authorizersConfigurationFile = properties.getAuthorizersConfigurationFile();

    // load the authorizers from the specified file
    if (authorizersConfigurationFile.exists()) {
        try {
            // find the schema
            final SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
            final Schema schema = schemaFactory.newSchema(Authorizers.class.getResource(AUTHORIZERS_XSD));

            // attempt to unmarshal
            final Unmarshaller unmarshaller = JAXB_CONTEXT.createUnmarshaller();
            unmarshaller.setSchema(schema);
            final JAXBElement<Authorizers> element = unmarshaller.unmarshal(XmlUtils.createSafeReader(new StreamSource(authorizersConfigurationFile)), Authorizers.class);
            return element.getValue();
        } catch (SAXException | JAXBException e) {
            throw new Exception("Unable to load the authorizer configuration file at: " + authorizersConfigurationFile.getAbsolutePath(), e);
        }
    } else {
        throw new Exception("Unable to find the authorizer configuration file at " + authorizersConfigurationFile.getAbsolutePath());
    }
}
 
开发者ID:apache,项目名称:nifi-registry,代码行数:23,代码来源:AuthorizerFactory.java

示例3: loadLoginIdentityProvidersConfiguration

import javax.xml.bind.JAXBElement; //导入方法依赖的package包/类
private IdentityProviders loadLoginIdentityProvidersConfiguration() throws Exception {
    final File loginIdentityProvidersConfigurationFile = properties.getIdentityProviderConfigurationFile();

    // 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(IdentityProviders.class.getResource(LOGIN_IDENTITY_PROVIDERS_XSD));

            // attempt to unmarshal
            XMLStreamReader xsr = XmlUtils.createSafeReader(new StreamSource(loginIdentityProvidersConfigurationFile));
            final Unmarshaller unmarshaller = JAXB_CONTEXT.createUnmarshaller();
            unmarshaller.setSchema(schema);
            final JAXBElement<IdentityProviders> element = unmarshaller.unmarshal(xsr, IdentityProviders.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());
    }
}
 
开发者ID:apache,项目名称:nifi-registry,代码行数:24,代码来源:IdentityProviderFactory.java

示例4: initialiseInventory

import javax.xml.bind.JAXBElement; //导入方法依赖的package包/类
private void initialiseInventory(EntityPlayerMP player, Inventory inventory)
{
    // Clear inventory:
    player.inventory.func_174925_a(null, -1, -1, null);
    player.inventoryContainer.detectAndSendChanges();
    if (!player.capabilities.isCreativeMode)
        player.updateHeldItem();

    // Now add specified items:
    for (JAXBElement<? extends InventoryObjectType> el : inventory.getInventoryObject())
    {
        InventoryObjectType obj = el.getValue();
        DrawItem di = new DrawItem();
        di.setColour(obj.getColour());
        di.setVariant(obj.getVariant());
        di.setType(obj.getType());
        ItemStack item = MinecraftTypeHelper.getItemStackFromDrawItem(di);
        if( item != null )
        {
            item.stackSize = obj.getQuantity();
            player.inventory.setInventorySlotContents(obj.getSlot(), item);
        }
    }
}
 
开发者ID:Yarichi,项目名称:Proyecto-DASI,代码行数:25,代码来源:ServerStateMachine.java

示例5: unmarshallAuthorizations

import javax.xml.bind.JAXBElement; //导入方法依赖的package包/类
private Authorizations unmarshallAuthorizations() throws JAXBException {
    final Unmarshaller unmarshaller = JAXB_AUTHORIZATIONS_CONTEXT.createUnmarshaller();
    unmarshaller.setSchema(authorizationsSchema);

    final JAXBElement<Authorizations> element = unmarshaller.unmarshal(new StreamSource(authorizationsFile), Authorizations.class);
    return element.getValue();
}
 
开发者ID:apache,项目名称:nifi-registry,代码行数:8,代码来源:FileAccessPolicyProvider.java

示例6: puraDocParagraph

import javax.xml.bind.JAXBElement; //导入方法依赖的package包/类
protected void puraDocParagraph(StrucDocParagraph paragraph, List<String> nayttomuoto) {
    List<Serializable> content = paragraph.getContent();
    for (int i = 0; i < content.size(); i++) {
        if ( content.get(i) instanceof JAXBElement ) {
            JAXBElement<?> elem = (JAXBElement<?>) content.get(i);
            if ( elem.getValue() instanceof StrucDocContent ) {
                StrucDocContent doc = (StrucDocContent) elem.getValue();
                puraDocContent(doc, nayttomuoto);
            }
        }

    }
}
 
开发者ID:TheFinnishSocialInsuranceInstitution,项目名称:KantaCDA-API,代码行数:14,代码来源:Purkaja.java

示例7: loadMetroConfig

import javax.xml.bind.JAXBElement; //导入方法依赖的package包/类
private static MetroConfig loadMetroConfig(@NotNull URL resourceUrl) {
    try (InputStream is = getConfigInputStream(resourceUrl)) {
        JAXBContext jaxbContext = createJAXBContext();
        Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
        XMLInputFactory factory = XmlUtil.newXMLInputFactory(true);
        JAXBElement<MetroConfig> configElement = unmarshaller.unmarshal(factory.createXMLStreamReader(is), MetroConfig.class);
        return configElement.getValue();
    } catch (Exception e) {
        String message = TubelineassemblyMessages.MASM_0010_ERROR_READING_CFG_FILE_FROM_LOCATION(
                resourceUrl != null ? resourceUrl.toString() : null);
        InternalError error = new InternalError(message);
        LOGGER.logException(error, e, Level.SEVERE);
        throw error;
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:16,代码来源:MetroConfigLoader.java

示例8: getId

import javax.xml.bind.JAXBElement; //导入方法依赖的package包/类
public String getId(JAXBElement e, XMLSerializer target) {
    // TODO: is this OK? Should we be returning the ID value of the type property?
    /*
        There's one case where we JAXBElement needs to be designated as ID,
        and that is when there's a global element whose type is ID.
    */
    Object o = e.getValue();
    if(o instanceof String)
        return (String)o;
    else
        return null;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:13,代码来源:ElementBeanInfoImpl.java

示例9: parse_file

import javax.xml.bind.JAXBElement; //导入方法依赖的package包/类
/**
 * Get parsed TraML object
 *
 * @param tramlFileName - file name
 * @param logger        - logger
 * @throws Exception - exception during parsing
 */
public void parse_file(String tramlFileName, Logger logger) throws Exception {

    JAXBContext ctx = JAXBContext.newInstance("ExternalPackages.org.hupo.psi.ms.traml");
    Unmarshaller um = ctx.createUnmarshaller();
    JAXBElement<TraMLType> jaxb_traml = (JAXBElement<TraMLType>) um.unmarshal(new File(tramlFileName));
    this.traML = jaxb_traml.getValue();

}
 
开发者ID:YcheCourseProject,项目名称:DIA-Umpire-Maven,代码行数:16,代码来源:TraMLParser.java

示例10: P11Conf

import javax.xml.bind.JAXBElement; //导入方法依赖的package包/类
public P11Conf(InputStream confStream, PasswordResolver passwordResolver)
        throws InvalidConfException, IOException {
    ParamUtil.requireNonNull("confStream", confStream);
    try {
        JAXBContext jaxbContext = JAXBContext.newInstance(ObjectFactory.class);
        Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
        SchemaFactory schemaFact = SchemaFactory.newInstance(
                javax.xml.XMLConstants.W3C_XML_SCHEMA_NS_URI);
        Schema schema = schemaFact.newSchema(getClass().getResource( "/xsd/pkcs11-conf.xsd"));
        unmarshaller.setSchema(schema);
        @SuppressWarnings("unchecked")
        JAXBElement<PKCS11ConfType> rootElement = (JAXBElement<PKCS11ConfType>)
                unmarshaller.unmarshal(confStream);
        PKCS11ConfType pkcs11Conf = rootElement.getValue();
        ModulesType modulesType = pkcs11Conf.getModules();

        Map<String, P11ModuleConf> confs = new HashMap<>();
        for (ModuleType moduleType : modulesType.getModule()) {
            P11ModuleConf conf = new P11ModuleConf(moduleType, passwordResolver);
            confs.put(conf.name(), conf);
        }

        if (!confs.containsKey(P11CryptServiceFactory.DEFAULT_P11MODULE_NAME)) {
            throw new InvalidConfException("module '"
                    + P11CryptServiceFactory.DEFAULT_P11MODULE_NAME + "' is not defined");
        }
        this.moduleConfs = Collections.unmodifiableMap(confs);
        this.moduleNames = Collections.unmodifiableSet(new HashSet<>(confs.keySet()));
    } catch (JAXBException | SAXException ex) {
        final String exceptionMsg = (ex instanceof JAXBException)
                ? getMessage((JAXBException) ex) : ex.getMessage();
        LogUtil.error(LOG, ex, exceptionMsg);
        throw new InvalidConfException("invalid PKCS#11 configuration");
    } finally {
        confStream.close();
    }
}
 
开发者ID:xipki,项目名称:xitk,代码行数:38,代码来源:P11Conf.java

示例11: isParametersMatch

import javax.xml.bind.JAXBElement; //导入方法依赖的package包/类
private boolean isParametersMatch(OpParameter opParam, JAXBElement<? extends ConfigurationProperty> pNode, StringBuilder reason, int i) {
   ConfigurationProperty prop = pNode.getValue();
   String name = prop.getName();
   if (!opParam.getName().equals(name)) {
      reason.append("parameter " + i + " name not match, expected: " + name + " but actual: " + opParam.getName() + "; ");
      return false;
   }

   return matchParameterType(opParam.getType(), prop, reason, i);
}
 
开发者ID:rh-messaging,项目名称:Artemis-JON-plugin,代码行数:11,代码来源:PluginDescriptorTest.java

示例12: Draw

import javax.xml.bind.JAXBElement; //导入方法依赖的package包/类
/**
 * Draws the specified drawing into the Minecraft world supplied.
 * @param drawingNode The sequence of drawing primitives to draw.
 * @param world The world in which to draw them.
 * @throws Exception Unrecognised block types or primitives cause an exception to be thrown.
 */
public void Draw( DrawingDecorator drawingNode, World world ) throws Exception
{
    beginDrawing(world);

    for(JAXBElement<?> jaxbobj : drawingNode.getDrawObjectType())
    {
        Object obj = jaxbobj.getValue();
        // isn't there an easier way of doing this?
        if( obj instanceof DrawBlock )
            DrawPrimitive( (DrawBlock)obj, world );
        else if( obj instanceof DrawItem )
            DrawPrimitive( (DrawItem)obj, world );
        else if( obj instanceof DrawCuboid )
            DrawPrimitive( (DrawCuboid)obj, world );
        else if (obj instanceof DrawSphere )
            DrawPrimitive( (DrawSphere)obj, world );
        else if (obj instanceof DrawLine )
            DrawPrimitive( (DrawLine)obj, world );
        else if (obj instanceof DrawEntity)
            DrawPrimitive( (DrawEntity)obj, world );
        else
            throw new Exception("Unsupported drawing primitive: "+obj.getClass().getName() );
    }

    endDrawing(world);
}
 
开发者ID:Yarichi,项目名称:Proyecto-DASI,代码行数:33,代码来源:BlockDrawingHelper.java

示例13: unmarshallTenants

import javax.xml.bind.JAXBElement; //导入方法依赖的package包/类
private Tenants unmarshallTenants() throws JAXBException {
    final Unmarshaller unmarshaller = JAXB_TENANTS_CONTEXT.createUnmarshaller();
    unmarshaller.setSchema(tenantsSchema);

    final JAXBElement<Tenants> element = unmarshaller.unmarshal(new StreamSource(tenantsFile), Tenants.class);
    return element.getValue();
}
 
开发者ID:apache,项目名称:nifi-registry,代码行数:8,代码来源:FileUserGroupProvider.java

示例14: generateDigest

import javax.xml.bind.JAXBElement; //导入方法依赖的package包/类
/**
 * Generates a digest for a complete message or field (which ever is handed over as first parameter).
 * During digest (SHA-256) generation, the parameter is converted to a JAXBElement and then EXI encoded 
 * using the respective EXI schema-informed grammar. If the digest for the signature is to be generated,  
 * the second parameter is to be set to true, for all other messages or fields the second parameter 
 * needs to be set to false.
 * 
 * @param jaxbMessageOrField The message or field for which a digest is to be generated, given as a JAXB element
 * @param digestForSignedInfoElement True if a digest for the SignedInfoElement of the header's signature is to be generated, false otherwise
 * @return The SHA-256 digest for message or field
 */
@SuppressWarnings("rawtypes")
public static byte[] generateDigest(String id, JAXBElement jaxbMessageOrField) {
	byte[] encoded; 
	
	// The schema-informed fragment grammar option needs to be used for EXI encodings in the header's signature
	getExiCodec().setFragment(true);
	
	/*
	 * When creating the signature value for the SignedInfoElement, we need to use the XMLdsig schema,
	 * whereas for creating the reference elements of the signature, we need to use the V2G_CI_MsgDef schema.
	 */
	if (jaxbMessageOrField.getValue() instanceof SignedInfoType) {
		encoded = getExiCodec().encodeEXI(jaxbMessageOrField, GlobalValues.SCHEMA_PATH_XMLDSIG.toString());
	} else encoded = getExiCodec().encodeEXI(jaxbMessageOrField, GlobalValues.SCHEMA_PATH_MSG_DEF.toString());
	
	// Do not use the schema-informed fragment grammar option for other EXI encodings (message bodies)
	getExiCodec().setFragment(false);
	
	if (encoded == null) {
		getLogger().error("Digest could not be generated because of EXI encoding problem");
		return null;
	}
	
	try {
		MessageDigest md = MessageDigest.getInstance("SHA-256");
		md.update(encoded);
		byte[] digest = md.digest();
		
		if (showSignatureVerificationLog) {
			/*
			 * Show Base64 encoding of digests only for reference elements, not for the SignedInfo element.
			 * The hashed SignedInfo element is input for ECDSA before the final signature value gets Base64 encoded.
			 */
			if ( !(jaxbMessageOrField.getValue() instanceof SignedInfoType) ) {
				getLogger().debug("\n"
								+ "\tDigest generated for XML reference element " + jaxbMessageOrField.getName().getLocalPart() + " with ID '" + id + "': " + ByteUtils.toHexString(digest) + "\n"
								+ "\tBase64 encoding of digest: " + Base64.getEncoder().encodeToString(digest));
			}
		}
			
		return digest;
	} catch (NoSuchAlgorithmException e) {
		getLogger().error("NoSuchAlgorithmException occurred while trying to create digest", e);
		return null;
	}
}
 
开发者ID:V2GClarity,项目名称:RISE-V2G,代码行数:58,代码来源:SecurityUtils.java

示例15: build

import javax.xml.bind.JAXBElement; //导入方法依赖的package包/类
/**
 * Build a class hierarchy from the input previously given with one of <code>set</code>-methods.
 * <p>Example usage:</p>
 * <pre>
 *   RsBuilder rsBuilder = new RsBuilder(new ResourceSyncContext());
 *   Optional&lt;RsRoot&gt; maybeRoot = rsBuilder.setInputStream(inStream).build();
 * </pre>
 * <p>We can test what concrete class was unmarshalled by obtaining the QName:</p>
 * <pre>
 *   Optional&lt;QName&gt; maybeQName = rsBuilder.getQName();
 * </pre>
 * <p>Or directly test one of two possibilities:</p>
 * <pre>
 *   Optional&lt;Sitemapindex&gt; maybeSitemapindex = rsBuilder.getSitemapindex();
 *   Optional&lt;Urlset&gt; maybeUrlset = rsBuilder.getUrlset();
 * </pre>
 *
 *
 * @return Optional of RsRoot
 * @throws JAXBException for invalid input
 */
@SuppressWarnings ("unchecked")
public Optional<RsRoot> build() throws JAXBException {
  latestQName = null;
  urlset = null;
  sitemapindex = null;

  JAXBElement<RsRoot> je = null;
  RsRoot rsRoot = null;
  Unmarshaller unmarshaller = rsContext.createUnmarshaller();
  if (file != null) {
    je = (JAXBElement<RsRoot>) unmarshaller.unmarshal(file);
    file = null;
  } else if (inputSource != null) {
    je = (JAXBElement<RsRoot>) unmarshaller.unmarshal(inputSource);
    inputSource = null;
  } else if (inputStream != null) {
    je = (JAXBElement<RsRoot>) unmarshaller.unmarshal(inputStream);
    inputStream = null;
  } else if (node != null) {
    je = (JAXBElement<RsRoot>) unmarshaller.unmarshal(node);
    node = null;
  } else if (reader != null) {
    je = (JAXBElement<RsRoot>) unmarshaller.unmarshal(reader);
    reader = null;
  } else if (source != null) {
    je = (JAXBElement<RsRoot>) unmarshaller.unmarshal(source);
    source = null;
  } else if (url != null) {
    je = (JAXBElement<RsRoot>) unmarshaller.unmarshal(url);
    url = null;
  } else if (xmlEventReader != null) {
    je = (JAXBElement<RsRoot>) unmarshaller.unmarshal(xmlEventReader);
    xmlEventReader = null;
  } else if (xmlStreamReader != null) {
    je = (JAXBElement<RsRoot>) unmarshaller.unmarshal(xmlStreamReader);
    xmlStreamReader = null;
  }

  if (je != null) {
    latestQName = je.getName();
    rsRoot = je.getValue();
    if (latestQName.equals(Urlset.QNAME)) {
      urlset = (Urlset) rsRoot;
    } else if (latestQName.equals(Sitemapindex.QNAME)) {
      sitemapindex = (Sitemapindex) rsRoot;
    }
  }
  return Optional.ofNullable(rsRoot);
}
 
开发者ID:EHRI,项目名称:rs-aggregator,代码行数:71,代码来源:RsBuilder.java


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