org.apache.camel.Converter.<init>()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(5.6k)|赞(0)|评价(0)|浏览(172)

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

Converter.<init>介绍

暂无

代码示例

代码示例来源:origin: org.apache.camel/camel-spring

@Converter
public final class ResourceConverter {

  private ResourceConverter() {
  }

  @Converter
  public static InputStream convertToInputStream(Resource resource) throws IOException {
    return resource.getInputStream();
  }

}

代码示例来源:origin: org.apache.camel/camel-spring

@Converter
public static InputStream convertToInputStream(Resource resource) throws IOException {
  return resource.getInputStream();
}

代码示例来源:origin: org.apache.camel/camel-cxf

@Converter
public static <T> CxfPayload<T> elementToCxfPayload(Element element, Exchange exchange) {
  List<T> headers = new ArrayList<>();
  List<Element> body = new ArrayList<>();
  body.add(element);
  return new CxfPayload<>(headers, body);
}

代码示例来源:origin: org.apache.camel/camel-cxf

@Converter
public static <T> CxfPayload<T> sourceToCxfPayload(Source src, Exchange exchange) {
  List<T> headers = new ArrayList<>();
  List<Source> body = new ArrayList<>();
  body.add(src);
  return new CxfPayload<>(headers, body, null);
}

代码示例来源:origin: org.apache.camel/camel-http-common

@Converter
public static ServletInputStream toServletInputStream(HttpMessage message) throws IOException {
  HttpServletRequest request = toServletRequest(message);
  if (request != null) {
    return request.getInputStream();
  }
  return null;
}

代码示例来源:origin: org.apache.camel/camel-cxf

@Converter
public static <T> Node cxfPayLoadToNode(CxfPayload<T> payload, Exchange exchange) {
  List<Element> payloadBodyElements = payload.getBody();
  if (payloadBodyElements.size() > 0) {
    return payloadBodyElements.get(0);
  }
  return null;
}

代码示例来源:origin: org.fusesource/camel-sap

@Converter
public static String toString(DocumentImpl document) {
  try {
    return Util.marshal(document);
  } catch (IOException e) {
    // Ignore
    LOG.warn("Failed to convert Document to String", e);
    return null;
  }
}

代码示例来源:origin: org.fusesource/camel-sap

@Converter
public static InputStream toInputStream(ResponseImpl structure) {
  try {
    return Util.toInputStream(structure);
  } catch (IOException e) {
    LOG.warn("Failed to convert Response to InputStream", e);
    return null;
  }
}

代码示例来源:origin: org.fusesource/camel-sap

@Converter
public static InputStream toInputStream(DocumentListImpl documentList) {
  try {
    return Util.toInputStream(documentList);
  } catch (IOException e) {
    LOG.warn("Failed to convert DocumentList to InputStream", e);
    return null;
  }
}

代码示例来源:origin: org.milyn/milyn-smooks-all

@SuppressWarnings("rawtypes")
@Converter
public static Integer toInteger(JavaResult.ResultMap result)
{
  return (Integer) getSingleObjectFromJavaResult(result);
}

代码示例来源:origin: org.milyn/milyn-smooks-all

@Converter
public static JavaSourceWithoutEventStream toJavaSourceWithoutEventStream(Object payload)
{
  return new JavaSourceWithoutEventStream(payload);
}

代码示例来源:origin: org.milyn/milyn-smooks-all

@Converter
public String toUNEDIFACTString(EDIWritable ediMessage) throws IOException {
  StringWriter ediWriter = new StringWriter();
  try {
    ediMessage.write(ediWriter, UNEdifactInterchangeParser.defaultUNEdifactDelimiters);
    return ediWriter.toString();
  } finally {
    ediWriter.flush();
    ediWriter.close();
  }
}

代码示例来源:origin: org.apache.camel/camel-twitter

@Converter
public static String toString(DirectMessage dm) throws ParseException {
  return new StringBuilder()
    .append(dm.getCreatedAt()).append(" (").append(dm.getSenderScreenName()).append(") ")
    .append(dm.getText())
    .toString();
}

代码示例来源:origin: org.apache.camel/camel-cxf

@Converter
public static String soapMessageToString(final SOAPMessage soapMessage, Exchange exchange) throws SOAPException, IOException {
  ByteArrayOutputStream baos = new ByteArrayOutputStream();
  soapMessage.writeTo(baos);
  return baos.toString(IOHelper.getCharsetName(exchange));
}

代码示例来源:origin: org.milyn/milyn-smooks-all

@Converter
public static JavaSource toJavaSource(JavaResult result)
{
  return new JavaSource(result.getResultMap().values());
}

代码示例来源:origin: org.apache.camel/camel-cxf

@Converter
public static MessageContentsList toMessageContentsList(final Object[] array) {
  if (array != null) {
    return new MessageContentsList(array);
  } else {
    return new MessageContentsList();
  }
}

代码示例来源:origin: org.apache.activemq/activemq-all

/**
 * Converts the inbound message exchange to an ActiveMQ JMS message
 *
 * @return the ActiveMQ message
 */
@Converter
public ActiveMQMessage toMessage(Exchange exchange) throws JMSException {
  ActiveMQMessage message = createActiveMQMessage(exchange);
  getBinding().appendJmsProperties(message, exchange);
  return message;
}

代码示例来源:origin: org.openehealth.ipf.platform-camel/ipf-platform-camel-ihe-xds

/**
 * Standard Camel converter for the Query response.
 * @param in
 *          an ebXML 3.0 object. 
 * @return a version independent response object.
 */
@Converter
public static QueryResponse convertToQueryResponse(AdhocQueryResponse in) {
  QueryResponseTransformer transformer = new QueryResponseTransformer(factory);
  return transformer.fromEbXML(new EbXMLQueryResponse30(in));
}

代码示例来源:origin: org.openehealth.ipf.platform-camel/ipf-platform-camel-ihe-xds

/**
 * Standard Camel converter for the Remove Documents request.
 * @param in
 *          an ebXML 3.0 object.
 * @return a version independent request object.
 */
@Converter
public static RemoveDocuments convert(RemoveDocumentsRequestType in) {
  RemoveDocumentsRequestTransformer transformer = new RemoveDocumentsRequestTransformer(factory);
  return transformer.fromEbXML(new EbXMLNonconstructiveDocumentSetRequest30<>(in));
}

代码示例来源:origin: org.apache.camel/camel-netty4

@Converter
public static StAXSource toStAXSource(ByteBuf buffer, Exchange exchange) {
  InputStream is = toInputStream(buffer, exchange);
  return exchange.getContext().getTypeConverter().convertTo(StAXSource.class, exchange, is);
}

相关文章

Converter类方法