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

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

本文整理了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

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

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

public void disposeMarshallers() {
  synchronized ( marshallers ) {
    for ( Marshaller marshaller : this.marshallers.values() ) {
      marshaller.dispose();
    }
    this.marshallers.clear();
  }
}

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

@Override
public ClassLoader getClassLoader() {
  return this.marshaller.getClassLoader();
}

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

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

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

protected String serialize(Object object) {
  if (object == null) {
    return "";
  }
  try {
    return marshaller.marshall(object);
  } catch ( MarshallingException e ) {
    throw new IllegalStateException( "Error while serializing request data!", e );
  }
}

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

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

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

protected String serialize(Object object) {
  if (object == null) {
    return "";
  }
  try {
    return marshaller.marshall( object );
  } catch ( MarshallingException e ) {
    throw new RuntimeException( "Error while serializing request data!", e );
  }
}

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

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

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

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

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

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

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

public void disposeMarshallers() {
  synchronized ( marshallers ) {
    for ( Marshaller marshaller : this.marshallers.values() ) {
      marshaller.dispose();
    }
    this.marshallers.clear();
  }
}

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

@SuppressWarnings("unchecked")
private <V> V marshallUnmarshall(V input) {
  try {
    String marshall = marshaller.marshall( input );
    System.out.println(marshall);
    V unmarshall = (V) marshaller.unmarshall(marshall, input.getClass());
    return unmarshall;
  } catch (Exception e) {
    e.printStackTrace();
    throw e;
  }
}

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

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

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

protected String serialize(Object object) {
  if (object == null) {
    return "";
  }
  try {
    return MarshallerFactory.getMarshaller(MarshallingFormat.JSON, this.getClass().getClassLoader()).marshall(object);
  } catch ( MarshallingException e ) {
    throw new IllegalStateException( "Error while serializing request data!", e );
  }
}

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

@AfterClass
 public static void teardown() {
  xStreamMarshaller.dispose();
  jaxbMarshaller.dispose();
  jsonMarshaller.dispose();
 }
}

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

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

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

protected void loadQueryDefinitions(final InputStream qdStream,
                    final Marshaller marshaller) throws IOException {
    final String qdString = IOUtils.toString(qdStream,
                         Charset.forName("UTF-8"));

    try {
      QueryDefinition[] queries = marshaller.unmarshall(qdString,
                               QueryDefinition[].class);

      LOGGER.info("Found {} query definitions",
            queries == null ? 0 : queries.length);

      if (queries == null) {
        return;
      }
      for (QueryDefinition q :
          queries) {
        LOGGER.info("Loaded query definition: {}",
              q);
        event.fire(new QueryDefinitionLoaded(q));
      }
    } catch (MarshallingException e) {
      LOGGER.error("Error when unmarshalling query definitions from stream.",
             e);
    }
  }
}

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

protected String serialize(Object object) {
  if (object == null) {
    return "";
  }
  try {
    return marshaller.marshall( object );
  } catch ( MarshallingException e ) {
    throw new KieServicesException( "Error while serializing request data!", e );
  }
}

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

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

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

public <T> T unmarshal(String data, String marshallingFormat, Class<T> unmarshalType) {
  if (data == null || data.isEmpty()) {
    return null;
  }
  MarshallingFormat format = getFormat(marshallingFormat);
  Marshaller marshaller = serverMarshallers.get(format);
  if (marshaller == null) {
    marshaller = MarshallerFactory.getMarshaller(getExtraClasses(registry), format, this.getClass().getClassLoader());
    serverMarshallers.put(format, marshaller);
  }
  Object instance = marshaller.unmarshall(data, unmarshalType);
  if (instance instanceof Wrapped) {
    return (T) ((Wrapped) instance).unwrap();
  }
  return (T) instance;
}

相关文章

微信公众号

最新文章

更多