org.kie.server.api.marshalling.Marshaller类的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(6.8k)|赞(0)|评价(0)|浏览(248)

本文整理了Java中org.kie.server.api.marshalling.Marshaller类的一些代码示例,展示了Marshaller类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Marshaller类的具体详情如下:
包路径:org.kie.server.api.marshalling.Marshaller
类名称:Marshaller

Marshaller介绍

[英]These Marshallers implementations must be thread-safe
[中]这些封送器实现必须是线程安全的

代码示例

代码示例来源:origin: kiegroup/droolsjbpm-integration

  1. private void verifyMarshallingRoundTrip( Marshaller marshaller, Object inputObject ) {
  2. String rawContent = marshaller.marshall( inputObject );
  3. Object testObjectAfterMarshallingTurnAround = marshaller.unmarshall( rawContent, inputObject.getClass() );
  4. Assertions.assertThat( testObjectAfterMarshallingTurnAround ).isEqualTo( inputObject );
  5. }

代码示例来源:origin: org.kie/kie-server-services

  1. public void disposeMarshallers() {
  2. synchronized ( marshallers ) {
  3. for ( Marshaller marshaller : this.marshallers.values() ) {
  4. marshaller.dispose();
  5. }
  6. this.marshallers.clear();
  7. }
  8. }

代码示例来源:origin: org.kie.server/kie-server-client

  1. @Override
  2. public ClassLoader getClassLoader() {
  3. return this.marshaller.getClassLoader();
  4. }

代码示例来源:origin: org.kie.server/kie-server-controller-client

  1. protected <T> T deserialize(String content, Class<T> type) {
  2. return marshaller.unmarshall( content, type );
  3. }
  4. }

代码示例来源:origin: org.kie.server/kie-server-controller-websocket-client

  1. protected String serialize(Object object) {
  2. if (object == null) {
  3. return "";
  4. }
  5. try {
  6. return marshaller.marshall(object);
  7. } catch ( MarshallingException e ) {
  8. throw new IllegalStateException( "Error while serializing request data!", e );
  9. }
  10. }

代码示例来源:origin: org.kie.server/kie-server-services-common

  1. private <T> T deserialize(String content, Class<T> type) {
  2. if (type == null) {
  3. return null;
  4. }
  5. try {
  6. return MarshallerFactory.getMarshaller(MarshallingFormat.JSON, this.getClass().getClassLoader()).unmarshall(content, type);
  7. } catch ( MarshallingException e ) {
  8. throw new IllegalStateException( "Error while deserializing data received from server!", e );
  9. }
  10. }

代码示例来源:origin: org.kie.server/kie-server-controller-client

  1. protected String serialize(Object object) {
  2. if (object == null) {
  3. return "";
  4. }
  5. try {
  6. return marshaller.marshall( object );
  7. } catch ( MarshallingException e ) {
  8. throw new RuntimeException( "Error while serializing request data!", e );
  9. }
  10. }

代码示例来源:origin: kiegroup/droolsjbpm-integration

  1. private void verifyMarshallingRoundTrip(Marshaller marshaller, Object inputObject) {
  2. String rawContent = marshaller.marshall(inputObject);
  3. Object testObjectAfterMarshallingTurnAround = marshaller.unmarshall(rawContent, inputObject.getClass());
  4. Assertions.assertThat(inputObject).isEqualTo(testObjectAfterMarshallingTurnAround);
  5. }

代码示例来源:origin: org.kie.server/kie-server-client

  1. protected <T> T deserialize(String content, Class<T> type) {
  2. logger.debug("About to deserialize content: \n '{}' \n into type: '{}'", content, type);
  3. if (content == null || content.isEmpty()) {
  4. return null;
  5. }
  6. try {
  7. return marshaller.unmarshall(content, type);
  8. } catch ( MarshallingException e ) {
  9. throw new KieServicesException( "Error while deserializing data received from server!", e );
  10. }
  11. }

代码示例来源:origin: stackoverflow.com

  1. Marshaller marshaller = org.opensaml.Configuration
  2. .getMarshallerFactory().getMarshaller(logoutRequest);
  3. org.w3c.dom.Element authDOM = marshaller.marshall(logoutRequest);
  4. StringWriter rspWrt = new StringWriter();
  5. XMLHelper.writeNode(authDOM, rspWrt);
  6. System.out.println(rspWrt.toString());

代码示例来源:origin: org.kie.server/kie-server-services-common

  1. public void disposeMarshallers() {
  2. synchronized ( marshallers ) {
  3. for ( Marshaller marshaller : this.marshallers.values() ) {
  4. marshaller.dispose();
  5. }
  6. this.marshallers.clear();
  7. }
  8. }

代码示例来源:origin: kiegroup/droolsjbpm-integration

  1. @SuppressWarnings("unchecked")
  2. private <V> V marshallUnmarshall(V input) {
  3. try {
  4. String marshall = marshaller.marshall( input );
  5. System.out.println(marshall);
  6. V unmarshall = (V) marshaller.unmarshall(marshall, input.getClass());
  7. return unmarshall;
  8. } catch (Exception e) {
  9. e.printStackTrace();
  10. throw e;
  11. }
  12. }

代码示例来源:origin: org.kie/kie-server-client

  1. private <T> T deserialize(String content, Class<T> type) {
  2. try {
  3. return marshaller.unmarshall( content, type );
  4. } catch ( MarshallingException e ) {
  5. throw new KieServicesException( "Error while deserializing data received from server!", e );
  6. }
  7. }

代码示例来源:origin: org.kie.server/kie-server-services-common

  1. protected String serialize(Object object) {
  2. if (object == null) {
  3. return "";
  4. }
  5. try {
  6. return MarshallerFactory.getMarshaller(MarshallingFormat.JSON, this.getClass().getClassLoader()).marshall(object);
  7. } catch ( MarshallingException e ) {
  8. throw new IllegalStateException( "Error while serializing request data!", e );
  9. }
  10. }

代码示例来源:origin: kiegroup/droolsjbpm-integration

  1. @AfterClass
  2. public static void teardown() {
  3. xStreamMarshaller.dispose();
  4. jaxbMarshaller.dispose();
  5. jsonMarshaller.dispose();
  6. }
  7. }

代码示例来源:origin: kiegroup/droolsjbpm-integration

  1. private void verifyMarshallingRoundTrip( Marshaller marshaller, Object inputObject ) {
  2. String rawContent = marshaller.marshall( inputObject );
  3. logger.info(rawContent);
  4. Object testObjectAfterMarshallingTurnAround = marshaller.unmarshall( rawContent, inputObject.getClass() );
  5. Assertions.assertThat( testObjectAfterMarshallingTurnAround ).isEqualTo( inputObject );
  6. }

代码示例来源:origin: kiegroup/jbpm-wb

  1. protected void loadQueryDefinitions(final InputStream qdStream,
  2. final Marshaller marshaller) throws IOException {
  3. final String qdString = IOUtils.toString(qdStream,
  4. Charset.forName("UTF-8"));
  5. try {
  6. QueryDefinition[] queries = marshaller.unmarshall(qdString,
  7. QueryDefinition[].class);
  8. LOGGER.info("Found {} query definitions",
  9. queries == null ? 0 : queries.length);
  10. if (queries == null) {
  11. return;
  12. }
  13. for (QueryDefinition q :
  14. queries) {
  15. LOGGER.info("Loaded query definition: {}",
  16. q);
  17. event.fire(new QueryDefinitionLoaded(q));
  18. }
  19. } catch (MarshallingException e) {
  20. LOGGER.error("Error when unmarshalling query definitions from stream.",
  21. e);
  22. }
  23. }
  24. }

代码示例来源:origin: org.kie.server/kie-server-client

  1. protected String serialize(Object object) {
  2. if (object == null) {
  3. return "";
  4. }
  5. try {
  6. return marshaller.marshall( object );
  7. } catch ( MarshallingException e ) {
  8. throw new KieServicesException( "Error while serializing request data!", e );
  9. }
  10. }

代码示例来源:origin: kiegroup/droolsjbpm-integration

  1. private void verifyMarshallingRoundTrip( Marshaller marshaller, Object inputObject ) {
  2. String rawContent = marshaller.marshall( inputObject );
  3. logger.info(rawContent);
  4. Object testObjectAfterMarshallingTurnAround = marshaller.unmarshall( rawContent, inputObject.getClass() );
  5. Assertions.assertThat( testObjectAfterMarshallingTurnAround ).isEqualTo( inputObject );
  6. }

代码示例来源:origin: org.kie.server/kie-server-services-common

  1. public <T> T unmarshal(String data, String marshallingFormat, Class<T> unmarshalType) {
  2. if (data == null || data.isEmpty()) {
  3. return null;
  4. }
  5. MarshallingFormat format = getFormat(marshallingFormat);
  6. Marshaller marshaller = serverMarshallers.get(format);
  7. if (marshaller == null) {
  8. marshaller = MarshallerFactory.getMarshaller(getExtraClasses(registry), format, this.getClass().getClassLoader());
  9. serverMarshallers.put(format, marshaller);
  10. }
  11. Object instance = marshaller.unmarshall(data, unmarshalType);
  12. if (instance instanceof Wrapped) {
  13. return (T) ((Wrapped) instance).unwrap();
  14. }
  15. return (T) instance;
  16. }

相关文章